Re: [sqlalchemy] pyodbc/{SQL SERVER} producing invalid query

2013-10-20 Thread Michael Bayer
On Oct 19, 2013, at 11:17 PM, aephi...@gmail.com wrote: Hi SQLAlchemy 0.8.2, Win32, Microsoft SQL Server ODBC Driver Briefly... class Uno(Base): __tablename__ = 'UNO' __table_args__ = { 'autoload':True, 'autoload_with':engine } duos =

Re: [sqlalchemy] pyodbc/{SQL SERVER} producing invalid query

2013-10-20 Thread aephie1a
at the moment a relationship() can't reliably be used as an expression in query(), there's a ticket to enhance this functionality at http://www.sqlalchemy.org/trac/ticket/2846. Based on what it seems like the intent here is, I think you want: session.query(Uno,

Re: [sqlalchemy] pyodbc/{SQL SERVER} producing invalid query

2013-10-20 Thread Michael Bayer
On Oct 20, 2013, at 7:00 PM, aephi...@gmail.com wrote: I do, but it doesn't work: NoForeignKeysError: Could not determine join condition between parent/child tables on relationship Uno.duos - there are no foreign keys linking these tables. Ensure that referencing columns are

Re: [sqlalchemy] pyodbc/{SQL SERVER} producing invalid query

2013-10-20 Thread aephie1a
it sounds like this is how your database was set up, or at least the columns related to this foreign key. It is. then those names in upper case with the quoting needs to be used. They don't. I can do select [DUO_duo] from [uno] and it works the same as without quotes. Perhaps because I'm

[sqlalchemy] Occasional InvalidRequestError: Table 'xxx' is already defined for this MetaData instance.

2013-10-20 Thread Joseph Casale
I have a module that is imported by several Python scripts run by an application that fires up a new interpreter session for each invocation. When not under load or running the code manually at the cli things work fine but once the concurrency raises and the application starts seeing some load it

Re: [sqlalchemy] Occasional InvalidRequestError: Table 'xxx' is already defined for this MetaData instance.

2013-10-20 Thread Michael Bayer
the MetaData object holds one Table object per unique name given. If you use the Table constructor more than once with the same name and the same MetaData, you get this error. That's how the error is caused, then the fact that the error is occasional points strongly to a race condition of