Hello all, I wonder if there is some interest in supporting master-slave schema natively in rails, with the usual approach: convention over configuration. I am about to explore how to implement it on the rails core, but I''d love to know if there is some interest in it. I think it would be great to have native support for this (without third party dependencies), in which you could configure in your database.yml the master database, and the read-only set of databases. That way rails could connect to one or another depending on what needs to be executed. If there is no read-only configuration specified, we''d assume that the schema is one master database only, and everything would work as nowadays. Thanks for all your work. Best regards, Rafael Fernández López. PS: I am close to find the time to start helping on github issues before/while working on this. :) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
In the last version our approach for new features was to write external gems before integrating to Rails repository. I personally like the idea of having support for master-slave in Rails but in my opinion it should grow up first as a gem. If the community embrace that gem and it show useful for the most part of application we can integrate it on the Rails repository. This project[1] for example was created as part of the Google Summer of Code project for the Rails organization and have support for master-slave but never was integrated in Rails repository, but in my opinion we don''t need to. [1]https://github.com/tchandy/octopus Rafael Mendonça França http://twitter.com/rafaelfranca https://github.com/rafaelfranca On Fri, Oct 11, 2013 at 11:31 AM, Rafael Fernández López <ereslibre@kde.org>wrote:> Hello all, > > I wonder if there is some interest in supporting master-slave schema > natively in rails, with the usual approach: convention over configuration. > I am about to explore how to implement it on the rails core, but I''d love > to know if there is some interest in it. > > I think it would be great to have native support for this (without third > party dependencies), in which you could configure in your database.yml the > master database, and the read-only set of databases. That way rails could > connect to one or another depending on what needs to be executed. If there > is no read-only configuration specified, we''d assume that the schema is one > master database only, and everything would work as nowadays. > > Thanks for all your work. > > > Best regards, > Rafael Fernández López. > > PS: I am close to find the time to start helping on github issues > before/while working on this. :) > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-core+unsubscribe@googlegroups.com. > To post to this group, send email to rubyonrails-core@googlegroups.com. > Visit this group at http://groups.google.com/group/rubyonrails-core. > For more options, visit https://groups.google.com/groups/opt_out. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
I find it great the idea of creating an external gem and integrate it to the core later on. I understand that not everything can go inside the core, but multiple database support (master-slaves) looks like something really important the core could have without installing external gems. I have been reading on this matter, and octopus looks nice, but what I actually want to avoid is this kind of API: User.where(:name => "Thiago").limit(3).using(:slave_one) I''d love to map internally to one or another database (master or any read-only replication) depending _on what the query will be_. This way you don''t have to mess with this kind of calls and everything happens in a transparent way. So, the final sql query involves read only queries, then we can safely access any of the replicas, however, if it involves any creation, deletion or modification, it will connect to the master one. Thank you. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
On Oct 11, 2013, at 11:03 AM, Rafael Fernández López wrote:> I find it great the idea of creating an external gem and integrate it to the core later on. I understand that not everything can go inside the core, but multiple database support (master-slaves) looks like something really important the core could have without installing external gems. > > I have been reading on this matter, and octopus looks nice, but what I actually want to avoid is this kind of API: > > User.where(:name => "Thiago").limit(3).using(:slave_one) > > I''d love to map internally to one or another database (master or any read-only replication) depending _on what the query will be_. This way you don''t have to mess with this kind of calls and everything happens in a transparent way. So, the final sql query involves read only queries, then we can safely access any of the replicas, however, if it involves any creation, deletion or modification, it will connect to the master one.That''s pretty much exactly what replication in octupus does: https://github.com/tchandy/octopus/wiki/replication :) --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.
There you go. Thanks :) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscribe@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at http://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/groups/opt_out.