[sqlalchemy] relationship joined to max() on a foreign table - help needed

2016-04-26 Thread Rob Fowler
Can anyone help me with this interesting (to me) relationship definition in sqla. I have some already defined data, not by me, that has, for each user, a foreign table of contact numbers, where the highest contact number is the one to use. For example, users: Harry, 1081, and Bob 1082

Re: [sqlalchemy] dogpile cache async_creation_runner question (actually with sqlalchemy but the example has the sqla factored out)

2015-01-04 Thread Rob Fowler
Thanks for the reply Mike. The explanation is somewhat as expected. Based on this, to keep things simple and being bone lazy, I switched the the 'redis' backend, whose locking is outside of the process and works 100% with multiple threads out of the box. -- You received this message because

[sqlalchemy] dogpile cache async_creation_runner question (actually with sqlalchemy but the example has the sqla factored out)

2015-01-03 Thread Rob Fowler
I have some costly aggregations (they take a minute) and I am firing off the aggregations in a separate thread and want to use the dogpile lock so that the client will receive the 'recent' data while the aggregation is occurring in the background. Using flask and sqla (as usual, sqla rocks, as

Re: [sqlalchemy] Getting the entity name, ideally the ORM class in the shard selector?

2013-04-23 Thread Rob Fowler
So anyone else who asks this knows, the following works: A query with just a column: qq = session.query(Configuration.name) Normally I would loop, but in this case, taking just the first column: yy = qq.column_descriptions[0]['expr'] yy.expression.table.name gives: ''configurations”

Re: [sqlalchemy] Getting the entity name, ideally the ORM class in the shard selector?

2013-04-22 Thread Rob Fowler
If the query does not have a table in it we don't get the tables. For example, the following simple query gets a list of connection_strings column from the Connection table: aa = session.query(Connection.connection_string) aa.column_descriptions [{'aliased': False, 'expr':

[sqlalchemy] Getting the entity name, ideally the ORM class in the shard selector?

2013-04-21 Thread Rob Fowler
We are using the sharding module included in our application. Currently we are selecting shards based on field. This works really well, as the field that gets hashed to select the shard needs to be migrated to the other tables that exist only in that shard. Now we would like to have