walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-19 16:36 UTC
Importing existing Oracle DB to Ruby
We are moving ColdFusion applications to Ruby on Rails and we would like to keep our existing data. Is there a way to import the Oracle schema into Ruby using one of the commands? Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
What do you mean by ''import into Ruby''? ActiveRecord (the database library of Rails) is capable of communicating with Oracle databases. Jason On 9/19/06, walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > We are moving ColdFusion applications to Ruby on Rails and we would > like to keep our existing data. Is there a way to import the Oracle > schema into Ruby using one of the commands? > > Thanks! > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
On 9/19/06, walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > We are moving ColdFusion applications to Ruby on Rails and we would > like to keep our existing data. Is there a way to import the Oracle > schema into Ruby using one of the commands? > > Thanks!I''m not sure what you''re asking. The schema isn''t "in" ruby. You can access it without any change at all to the database if you like. Might require some tweaking to your ActiveRecord models if the schema is not using AR''s naming conventions (which would be a miracle if it were.) *OR*, you can port it to what ActiveRecord expects with its defaults, which will make ongoing development quite a bit easier. -- Imagination is more important than knowledge. -- Albert Einstein --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Sep-19 17:11 UTC
Re: Importing existing Oracle DB to Ruby
Let me clarify, I suppose I''m looking for is a tutorial or a way to have a Ruby app created based on an existing schema. I''m a newbie so I''m not sure if I mean a scaffold. The examples I''ve found so far let me create new databases which work fine. Sorry for the confusion. Thanks Michael Campbell wrote:> On 9/19/06, walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > We are moving ColdFusion applications to Ruby on Rails and we would > > like to keep our existing data. Is there a way to import the Oracle > > schema into Ruby using one of the commands? > > > > Thanks! > > > I''m not sure what you''re asking. The schema isn''t "in" ruby. You can > access it without any change at all to the database if you like. > Might require some tweaking to your ActiveRecord models if the schema > is not using AR''s naming conventions (which would be a miracle if it > were.) > > *OR*, you can port it to what ActiveRecord expects with its defaults, > which will make ongoing development quite a bit easier. > > -- > Imagination is more important than knowledge. -- Albert Einstein--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Hi ! 2006/9/19, walksalong@gmail.com <walksalong@gmail.com>:> I suppose I'm looking for is a tutorial or a way to have a Ruby app > created based on an existing schema. I'm a newbie so I'm not sure if I > mean a scaffold. The examples I've found so far let me create new > databases which work fine. Sorry for the confusion.Hmmm, I'd say that the scaffolding is what you want, to at least see if you can access your existing data. Start with a fresh Rails application. Setup config/database.yml correctly. Then, use the console to confirm you can communicate with the database: $ script/console> ActiveRecord::Base.connection.execute("SHOW TABLES")If you get an error, your connection parameters are incorrect. Then, you can start building your scaffold: $ script/generate scaffold User Hope that helps ! François Beausoleil --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Use rake to generate a model for your existing table in Oracle (once you have set up the database.yml in config, as Francois already said)..."rake generate model Foo". Then, use the line "set_table_name ''bar''" in the model class to specify the Oracle table name. You may also have to use commands like that to set the primary key, etc. Fromthere you can generate a scaffold, "rake generate scaffold Foo". If prompted, don''t overwrite the existing model class file. That will give you scaffold views into your existing Oracle data. HTH, Nathan -----Original Message----- From: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org]On Behalf Of walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Sent: Tuesday, September 19, 2006 12:12 PM To: Ruby on Rails: Talk Subject: [Rails] Re: Importing existing Oracle DB to Ruby Let me clarify, I suppose I''m looking for is a tutorial or a way to have a Ruby app created based on an existing schema. I''m a newbie so I''m not sure if I mean a scaffold. The examples I''ve found so far let me create new databases which work fine. Sorry for the confusion. Thanks Michael Campbell wrote:> On 9/19/06, walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <walksalong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > We are moving ColdFusion applications to Ruby on Rails and we would > > like to keep our existing data. Is there a way to import the Oracle > > schema into Ruby using one of the commands? > > > > Thanks! > > > I''m not sure what you''re asking. The schema isn''t "in" ruby. You can > access it without any change at all to the database if you like. > Might require some tweaking to your ActiveRecord models if the schema > is not using AR''s naming conventions (which would be a miracle if it > were.) > > *OR*, you can port it to what ActiveRecord expects with its defaults, > which will make ongoing development quite a bit easier. > > -- > Imagination is more important than knowledge. -- Albert Einstein--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---