I recently submitted a patch to allow for shards to be dynamically  
added to the connection pool at runtime. It's working well.

Now I have a new use case where I need to modify a schema on a shard,  
but I don't know how I can do that. The only way to address a shard  
directly is through Dataset#server which obviously doesn't allow any  
calls to #alter_table (or others).

I can get to the correct database shard by using the  
Sequel:Database#synchronize call, but it yields (in my case) a  
Java::OrgH2Jdbc::JdbcConnection. I can't use any of the nice schema  
generator calls on that object (it's a Java object).

Is it possible for me to go from a JdbcConnection object back to a  
Sequel:Database reference?

Is there another way to address a database shard without going through  
Sequel:Dataset?

Ideally, I would like to be able to do something like this:

shards = #some hash
DB = Sequel.connect "jdbc:h2:master_server", :servers => shards
....
DB.server(some_shard_id).create_table :test do
   ..
   ..
end

Alternately, if there was a way for me to capture the ddl output by  
the schema methods, I could call #execute on the connection (attained  
through #synchronize) and pass in the DDL. Is it possible to get the  
DDL from a #create_table block?

I've been looking through the code for hours but I can't find any way  
of accomplishing this task. I thought I might be able to mimic the  
behavior of Sequel:Dataset and just clone the Sequel:Database object  
while passing in my specified shard server, but the clone  
functionality isn't present in Sequel:Database. (And I don't know if  
it is safe to use Object#clone on the Sequel:Database to do this work.)

Any suggestions would be welcome.

cr

--

You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.


Reply via email to