[sqlalchemy] unable to understand this error

2010-02-16 Thread anusha kadambala
hello all, My tables are giving following error at the time of querying. The tables got created properly but when i query on some table it is showing error on other tables.I didnt understand whats the issue here. I am querying on login table it is giving error on debitnote details tables.

[sqlalchemy] Re: unable to understand this error

2010-02-16 Thread avdd
Hi anusha, The error is unrelated to your Login query because sqlalchemy compiles the mappers as late as possible. It might help if you put somewhere in your application code, after you have imported all your entities, the lines: from sqlalchemy import orm orm.compile_mappers() to catch

Re: [sqlalchemy] Re: unable to understand this error

2010-02-16 Thread anusha kadambala
hi avdd, On Tue, Feb 16, 2010 at 7:01 PM, avdd adr...@gmail.com wrote: Hi anusha, The error is unrelated to your Login query because sqlalchemy compiles the mappers as late as possible. It might help if you put somewhere in your application code, after you have imported all your entities,

Re: [sqlalchemy] Re: unable to understand this error

2010-02-16 Thread Krishnakant Mane
On Tuesday 16 February 2010 07:01 PM, avdd wrote: Now the specific problem you see is that the ORM uses the declared ForeignKeys to determine how to join tables for a relation, but on your Detail table you have two foreign keys back to account and the ORM doesn't know which one to use.

Re: [sqlalchemy] Re: unable to understand this error

2010-02-16 Thread werner
On 16/02/2010 15:48, Krishnakant Mane wrote: On Tuesday 16 February 2010 07:01 PM, avdd wrote: Now the specific problem you see is that the ORM uses the declared ForeignKeys to determine how to join tables for a relation, but on your Detail table you have two foreign keys back to account and

[sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. Here is a simple example of using joins in SQLAlchemy: from sqlalchemy import schema, types, sql, create_engine metadata = schema.MetaData() x = schema.Table( 'x', metadata, schema.Column('id', types.Integer, primary_key=True),

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Michael Bayer
Manlio Perillo wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi. Here is a simple example of using joins in SQLAlchemy: from sqlalchemy import schema, types, sql, create_engine metadata = schema.MetaData() x = schema.Table( 'x', metadata, schema.Column('id',

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: Manlio Perillo wrote: [...] query = sql.join(x, y).select() r = engine.execute(query).fetchone() [...] This code will raise an: sqlalchemy.exc.InvalidRequestError: Ambiguous column name 'id' in result set!

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: [...] Unfortunately, fold_equivalents is not a generic solution for me I have a generative query, where I later add the select_from object. The query is generative, since the tables involved are not know in advance. I

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: Manlio Perillo wrote: Here is the code I have: http://paste.pocoo.org/show/178959/ What each plugin do is: - add additional columns in the select list - add additional where clauses or order_by clauses I don't see

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Michael Bayer
Manlio Perillo wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: Manlio Perillo wrote: Here is the code I have: http://paste.pocoo.org/show/178959/ What each plugin do is: - add additional columns in the select list - add additional where clauses or order_by

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Manlio Perillo
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: [...] just so I can understand fully can you modify the paste I sent to illustrate exactly how the results are happening, as that can help me to formulate the best version of this feature. I have pasted a complete

Re: [sqlalchemy] inner join and ambiguous columns

2010-02-16 Thread Michael Bayer
On Feb 16, 2010, at 7:07 PM, Manlio Perillo wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Michael Bayer ha scritto: [...] just so I can understand fully can you modify the paste I sent to illustrate exactly how the results are happening, as that can help me to formulate the best