On Jun 25, 2008, at 6:30 PM, lilo wrote:
> > I am trying to understand what id_chooser and query_chooser do. > Id_chooser basically uses a instance primary key to determine what > shard the intance should be saved to? id_chooser receives a primary key identifier, and then returns a list of shards in which to search for that primary key. If you dont know which shard to look on, it can return all the shards and they'll all be checked in the order they were given. Obviously its better if it returns a single shard identifier. If your app got hit a lot with get- by-primary-keys and you couldn't determine the best shard, you might want to return the shards in a different order each time to balance load. > My primary keys(globally > unique) are made of up more than one fields. Would that be a problem > with Id_chooser? the argument to id_chooser is a list, forming a composite identiifer. > How/when would do you query_chooser? the Query calls upon query_chooser when it is ready to return instances, passing in itself as an argument. the function returns the list of shards in which to execute the query, and the total results of all those shards are aggregated together. > Can you set id_chooser and query_chooser to be None in: > > create_session.configure(shards = {blah}, shard_chooser = > shard_chooser, id_chooser = None, query_chooser = None) ? nope. sharding requires these in order to do its work. If you want a "default" chooser function, have them return a list of all shard names. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---