Re: [sqlalchemy] column_property on a related table with substring

2010-12-03 Thread Nagy Viktor
sorry, you were right, I've had a different bug in my code On Thu, Dec 2, 2010 at 5:19 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Dec 2, 2010, at 10:07 AM, Nagy Viktor wrote: I've tried what you proposed, but it still doesn't work: my code is now: production_request =

[sqlalchemy] column_property and relationship

2010-12-03 Thread Nagy Viktor
Hi, is it possible to define a relationship over a column property? the column property returns an id, and it would be nice to get the related object via a relationship easily. I've tried a couple of things, but the didn't work out, like: production_request_id = column_property(

[sqlalchemy] Adding expressions to a Query

2010-12-03 Thread Jurie-Jan Botha
I can't seem to find a way to add an expression to an ORM Query as a column. I need to add it after the Query object is initialized. The expressions that I'm trying to add is a function like 'func.ts_rank_cd'. Thanks in advance. -- You received this message because you are subscribed to the

[sqlalchemy] Re: Selective relationship cascade

2010-12-03 Thread neurino
Thanks Michael, and what about `type` relationship? Or would it be much simpler have no relation at all, since there must be no actions on children on parent update / delete? If I had to do this with plain SQL I'd simply make a `measures LEFT JOIN types ON measures.type_id = types.id` to

[sqlalchemy] group by and Oracle

2010-12-03 Thread jo
Hi all, I'm trying to write a GROUP BY query grouped by a function (to_char) using a variable format, which could be 'yy' or '' as in: sql=session.query( func.to_char(Prestazione.c.data,format), func.sum(Prestazione.c.quantita).label('quantita'),

Re: [sqlalchemy] Adding expressions to a Query

2010-12-03 Thread Nagy Viktor
one option would be to add the expression to your model as a column_property On Fri, Dec 3, 2010 at 9:06 AM, Jurie-Jan Botha juriejanbo...@gmail.comwrote: I can't seem to find a way to add an expression to an ORM Query as a column. I need to add it after the Query object is initialized. The

Re: [sqlalchemy] group by and Oracle

2010-12-03 Thread Ian Kelly
On Fri, Dec 3, 2010 at 4:08 AM, jo jose.soa...@sferacarta.com wrote: Hi all, I'm trying to write a GROUP BY query grouped by a function (to_char) using a variable format, which could be 'yy' or '' as in: sql=session.query(   func.to_char(Prestazione.c.data,format),  

[sqlalchemy] Re: Accessing multiple databases with same schema

2010-12-03 Thread Eric N
I had a similar issue that I resolved by creating a set_data_model function that when I called in it would set some global variable to the table objects based on the product passed in to the function. I'm using multiple schemas in a Postgres database and wanted to try to limit the number of

[sqlalchemy] Convert Declarative definitions to Table definitions

2010-12-03 Thread Thadeus Burgess
I'm about to use sqlalchemy-migrate, however all of my tables are already in a declarative format. Is there a script out there that will convert a declarative model syntax to table model? I'm looking to just paste my model in declarative and it spit out a tablename = Table(...) format for me to

[sqlalchemy] Re: Convert Declarative definitions to Table definitions

2010-12-03 Thread Thadeus Burgess
Ok, it was easier I thought with much thanks to the great __repr__() strings that SQLAlchemy uses... made life so much easier Here is the script I used, just pass the class object to the function and it returns a string in table_name = Table(...) form. Since this is just being used for