Hello again, I'm getting errors in a certain case which lead me to suspect that I'm missing some big picture sharding concept, so to better understand sharding I'm playing with the SQLAlchemy sharding unit tests (sqlalchemy/test/orm/sharding/test_shard.py).
Here's one of the investigative tests I've added in order to better understand query_chooser: def test_read(self): session = create_session() query = session.query(WeatherLocation) print "get tokyo:" # query_chooser returns: ['asia'] tokyo = query.filter_by(city='Tokyo').filter_by (continent='Asia').first() print "access tokyo:" # query_chooser returns: ['north_america', 'asia', 'europe', 'south_america'] assert tokyo.city == "Tokyo" My question: If we already have an instance of tokyo from the 'get tokyo' code snippet, why is a new query_cls being instantiated to rerfesh the tokyo object on access (thus having to traverse all 4 shards) rather than using shard_chooser and the got instance to compute the shard based on its continent value? Is there some way I can optimize this case, perhaps by setting the shard_id somewhere, so that 4 queries aren't executed in this case? Hope that was clear enough. Thanks again for your time, --diana
-- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.