I'm trying to use the DB Sharding features of Sequel described on the
sharding
page http://sequel.jeremyevans.net/rdoc/files/doc/sharding_rdoc.html.
Specifically I'm trying use the `with_server` block so that I can switch
connections inside a block.
Here is my connection setup
servers = {
"server1"=> {
"adapter"=>"oracle",
"database"=>"db1",
"username"=>"user1",
"password"=>"password2"},
"server2"=> {
"adapter"=>"oracle",
"database"=>"db2",
"username"=>"user2",
"password"=>"password2"
}
}
default = servers.values.first
STUDY_DB = Sequel.connect(adapter: 'oracle', database: default['database'],
username: default['username'], password: default['password'], servers:
servers)
STUDY_DB.extension :server_block
STUDY_DB.extension :arbitrary_servers
Sequel::Model.plugin :sharding
And the query I'm trying to run
STUDY_DB.with_server('server2') do
STUDY_DB.synchronize do
StudyUser.all
end
end
STUDY_DB.with_server('server1') do
STUDY_DB.synchronize do
StudyUser.all
end
end
The issue is that when I do the block for 'server2' I get the results for
the default DB, 'server1'.
Is there something I'm missing in the configuration? Does the Oracle
adapter fully support sharding and DB switching?
Note I am using OCI8 to connect to the DB and the connection hashes in the
servers hash each work by themselves.
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.