On Tuesday, January 26, 2016 at 11:31:53 AM UTC-8, Milutin Ivkovic wrote:
>
> Dear Jeremy,
>
> I am using Sequel's sharding in my Sinatra app, so i have few questions 
> about sharding.
>
> If I use DB.transaction( :server => :testserver ), does all queries in 
> transaction's block are executed with same shard?
>

No, it only chooses which shard will be used for the transaction itself.
 

> Or should I use .with_server extension? Which solution is more secure to 
> use, so all queries go to wanted shard.
>

You should use the server_block extension if you want all queries inside a 
block to use a given shard.
 

> Also if i have method:
>
> def test
>       data = Model[id]
> end
>
> and if i call this method in with_server or transaction block, will query 
> from method go to wanted shard?
>

When using with_server from the server block extension, yes, the shard you 
passed to with_server will be used if it the test method is called inside 
the block.

Thanks,
Jeremy

-- 
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 https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to