On Jun 2, 8:01 pm, Jeremy Evans <[email protected]> wrote: > On Jun 2, 6:29 pm, Hiten <[email protected]> wrote: > > > There is a way to know which table to query. > > > Sure. Say 4 hosts with 4 tables each. Every item has an id. The last > > digit (hex) signifies the table and host. > > In the Sequel model, you'd probably want to override this: > > TABLES = {'0'=>[:shard_a, :table_a], > '1'=>[:shard_a, :table_b], > ... > 'e'=>[:shard_d, table_c], > 'f'=>[:shard_d, :table_d]} > def this > shard, table = TABLES[id[-1..-1]] > super.from(table).server(shard) > end >
What would you do in a situation where the particular table had no relation to the id? For instance, each row is identified by a table number and id (e.g., [ 7 , 1234 ] would signify Table07 and row id 1234). Seems that the table name would need to be accessible somewhere. Is the table name accessible from a Sequel model instance? -- 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.
