Sharding: query_chooser(query) example broken

Issue #1491 resolved
Former user created an issue

(This matters since basically the only sqlalchemy sharding documentation is in this one example)

http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/sharding/attribute_shard.py

The line numbers refer to the original attribute_shard.py. I have attached my own, to illustrate the problem

on line 134: if binary.left is weather_locations.c.continent:

This always evaluates as False.

It should be reached by e.g. Line 194: assert t.reports0.temperature == 80.0

This indeed calls the query_choser, but since there is a catchall, which just returns all the shards, it works, and the actual problem remains unnoticed. However, the whole point of sharding (and therefore the query_chooser), is to only search the shards where (parts of) the results can be found.

The fix is not clear to me. Should the instances compared on Line 135 indeed be the same? Should another comparison be made? Which one?

Comments (2)

  1. Log in to comment