Re: [sqlalchemy] One-off listeners

2013-11-26 Thread George Sakkis
On Monday, 25 November 2013 17:27:02 UTC+2, Michael Bayer wrote: On Nov 25, 2013, at 9:00 AM, George Sakkis george...@gmail.comjavascript: wrote: Hi all, is there a feature or pattern for adding a listener that is to be executed (at most) once? For example, say you want to send

[sqlalchemy] Scalar sub query as literal column

2013-11-26 Thread Joseph Casale
I have a scalar sub query with a predicate that involves a table and column produced in the outer query, Company.id for example. The only way I could include the query was to write it out literally and add it as a column with literal_column. query = session.query(Company, City, ...,

Re: [sqlalchemy] One-off listeners

2013-11-26 Thread Michael Bayer
On Nov 26, 2013, at 3:41 AM, George Sakkis george.sak...@gmail.com wrote: On Monday, 25 November 2013 17:27:02 UTC+2, Michael Bayer wrote: On Nov 25, 2013, at 9:00 AM, George Sakkis george...@gmail.com wrote: Hi all, is there a feature or pattern for adding a listener that is

Re: [sqlalchemy] Many parents to one child table query filter. How make it properly?

2013-11-26 Thread mando
Il giorno martedì 26 novembre 2013 02:52:44 UTC+1, Michael Bayer ha scritto: not totally sure what you’re going for here as I think you’re looking at the problem using a different vocabulary. From the query you have at the bottom, it appears you’d want this: for teacher in

Re: [sqlalchemy] Can sqlalchemy help me solve this contraint issue?

2013-11-26 Thread John Kida
Sorry I slightly misrepresented the schema. An Account does not have a company id column. So in your opinion what's the best option here. I have a company that may or maynot have a reference to an account. However both the company and the aacount tables need to have a way to link multiple

Re: [sqlalchemy] String aggregation

2013-11-26 Thread Michael Bayer
you can send any number of arguments to func.XYZ(), they will be comma separated, so you can say: func.group_concat(TableA.name, literal_column(“‘|'”)) On Nov 25, 2013, at 2:16 PM, Joseph Casale jcas...@gmail.com wrote: While not utilizing newer methods, this produced the desired effect:

Re: [sqlalchemy] Scalar sub query as literal column

2013-11-26 Thread Michael Bayer
On Nov 26, 2013, at 7:45 AM, Joseph Casale jcas...@gmail.com wrote: I have a scalar sub query with a predicate that involves a table and column produced in the outer query, Company.id for example. this is called a correlated subquery. The only way I could include the query was to write

Re: [sqlalchemy] Can sqlalchemy help me solve this contraint issue?

2013-11-26 Thread Michael Bayer
On Nov 26, 2013, at 11:23 PM, John Kida jdk...@gmail.com wrote: Sorry I slightly misrepresented the schema. An Account does not have a company id column. So in your opinion what's the best option here. I have a company that may or maynot have a reference to an account. OK well assuming the

Re: [sqlalchemy] Polymorphic on another table?

2013-11-26 Thread 史永宏
Hi, Is there a solution for this issue today? Now I have a single table Inheritance in table A, however, the type information is stored in another table B linked from A with foreign key... Now if I want to get polymorphic result when querying A, I got error ask me to either use polymorphic or