Re: [sqlalchemy] session query and column names

2015-01-13 Thread Mehdi
I have a model with two relations which i set them as lazy=joined. so i was thinking while they are already joined, i can filter relation objects without using join() in query. but i was wrong. this is what working for me: query = session.query(MyModel) \ .join(BModel) \

Re: [sqlalchemy] session query and column names

2015-01-13 Thread jo
Can you send us an example how your myModel is? j Mehdi wrote: How could i guess the proper aliased column name then? In your example your table is specie and column name is codice, so you used specie_codice=42. but as i said i have joins and longer column names, so sometimes i get like

Re: [sqlalchemy] session query and column names

2015-01-13 Thread Simon King
On Mon, Jan 12, 2015 at 10:45 AM, Mehdi mese1...@gmail.com wrote: Hi I want to make a query with given filters received from client side. client side sends a json array like this: [ 0DA: {conditionType: null, column: serialNumber, operator: GREATER_THAN, value: 50}, 1DG:

[sqlalchemy] session query and column names

2015-01-12 Thread Mehdi
Hi I want to make a query with given filters received from client side. client side sends a json array like this: [ 0DA: {conditionType: null, column: serialNumber, operator: GREATER_THAN, value: 50}, 1DG: {conditionType: AND, column: name, operator: EQUAL, value: john } ] I've managed

Re: [sqlalchemy] session query and column names

2015-01-12 Thread Jose Soares
Why don't you pass the params to session.query as a dictionary into filter_by as in: In [1]: by_where_clause=dict(specie_codice='42', specie_descrizione='Nutrie') In [2]: print session.query(Specie).filter_by( **by_where_clause ).count() 2015-01-12 12:37:40,518 INFO

Re: [sqlalchemy] session query and column names

2015-01-12 Thread Mehdi
How could i guess the proper aliased column name then? In your example your table is specie and column name is codice, so you used specie_codice=42. but as i said i have joins and longer column names, so sometimes i get like table1.somelongcolumn AS table1_somelong_7. On Monday, January 12,