Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-19 Thread Richard Gerd Kuesters
yes. but i'll always have to use a bind anyway. this routing style has a problem to identify what entity you're querying (and then the mapper) when using functions, either at column level session.query(func.count(MyObj.attribute)) or at the query level itself

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-18 Thread Michael Bayer
thats why I have a hard time with your questions, you seem to have some deeply unusual and intricate application that is lending itself to needing all these new patterns. That's not to say I don't have some unusual patterns in some of my applications, but when those use cases come up I had to

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-18 Thread Richard Gerd Kuesters
thanks Mike for your help, and I'm very, very sorry for consuming your time with my awkard questions. anyway, what i said about my app is just part of it. imagine that i have a lot of mapped classes to integrate my application (online, cloud based, message based, etc etc) against some other

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-18 Thread Michael Bayer
On May 18, 2014, at 12:10 PM, Richard Gerd Kuesters rich...@humantech.com.br wrote: well, this part is still working, as long as i remember. my biggest problem now - and has been for the last couple of years - is to manage this mayhem of classes and engines AND sessions, because everyone

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-18 Thread Richard Gerd Kuesters
yeah, well, i was using implicit for little things and explicit for the bigger ones, but it seems that even small things are error prone :) i was just wondering if there's a faster way to do it, even explicit, so i can get a class (whatever it is) to query against an engine i know (so there's

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-18 Thread Michael Bayer
well if you're working with the RoutingSession example you can manufacture get_bind() and using_bind() to work in any way you want. If you have the engine, as the example shows, session.using_bind(some_bind).query(...)

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-17 Thread Richard Kuesters
hi! sorry for bringing this up so late - sometimes we just have no time to get in sync with all threads :) this is a subject that interests me. i mean, let me explain my current condition: i have a set of declarative classes that i get by calling a function, passing it's declarative base as

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-17 Thread Michael Bayer
Just a thought if you're really mapping tons of classes on the fly as some kind of en masse table gateway maybe look at automap Sent from my iPhone On May 17, 2014, at 1:43 PM, Richard Kuesters rkuest...@gmail.com wrote: hi! sorry for bringing this up so late - sometimes we just have no

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-17 Thread Richard Gerd Kuesters
in fact, i map classes against different metadata for different schemas, since i like to have specialized parts of my app distributed in the database (the postgres part). another part of my app generated sqlite databases on the fly, based on the same structures conceived earlier. kinda strange

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-08 Thread Julien Meyer
Thank you very much for your advice. Le mardi 6 mai 2014 17:21:55 UTC+2, Michael Bayer a écrit : set_shard is a special method added by the horizontal sharding extension. you can do cross schema queries if you organize the schema names in terms of which ones apply to the “dynamic” shard

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-06 Thread Julien Meyer
My real database schema is a little more complex. In reality, I have one database by company. In each database, I have multiple schemas who contain the same table structure. The solution schema name execution will not work in the case when I need to access to more than one schema by request.

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-06 Thread Michael Bayer
set_shard is a special method added by the horizontal sharding extension. you can do cross schema queries if you organize the schema names in terms of which ones apply to the dynamic shard and which ones to the fixed shard, if that's how it works. If OTOH you literally need to join against

[sqlalchemy] Entity name - multiple schema - relationship

2014-05-05 Thread Julien Meyer
I need some help and advices to create a mapping. The context : - Multiple schemas on postgresql (dynamic number and name) who store the same tables. - SQLAlchemy used into a pyramid web application. Example : A table Customer and a table CustomerOrder (link by customer.id) and a schema by

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-05 Thread Michael Bayer
part of a feature that will make this kind of thing more direct is the schema name execution argument feature, which is https://bitbucket.org/zzzeek/sqlalchemy/issue/2685/default-schema-as-an-execution-argument. This application is somewhat of a multi-tenancy application; technically its