[sqlalchemy] Query for an empty to_many relationship?

2008-02-25 Thread Gaetan de Menten
Hello all, I'm puzzled as I cannot seem to do a pretty simple query: I have a many to many relationship (say from Vendor to Item) and want to get a list of all vendors which have no item. The obvious: Vendor.query.filter(Vendor.items == []).all() does not work (it produce a query without any

[sqlalchemy] _CompileOnAttr when executed under Pylons

2008-02-25 Thread Artur
In Pylons webapp, module model I have three tables, orm-mapped with autoload=True, and join them as the following: result_select = select([ merk_table.c.nMerkID, merk_table.c.Merknaam, model_table.c.nModelID, model_table.c.Modelnaam,

[sqlalchemy] Re: Reflecting tables with foreign keys

2008-02-25 Thread Don Dwiggins
Michael Bayer wrote: hi don - heres a script using SQLite which illustrates how the foreign key reflection works. This same sort of thing should be working on MS-SQL as well but I dont have access to an MS-SQL server here to test. If the example below is not working for MS-SQL,

[sqlalchemy] Avoiding reflection (was: Re: Reflecting tables with foreign keys)

2008-02-25 Thread Don Dwiggins
Rick Morrison wrote: Ugg, I am not a big table reflection fan:-( I am in the middle of readying a presentation, so unless someone else wants to jump on this, I'll take a look at this later on this week, along with integrating a reflection speed-up patch I remember from a while back.

[sqlalchemy] Re: Avoiding reflection (was: Re: Reflecting tables with foreign keys)

2008-02-25 Thread Rick Morrison
I actually keep most of my DB schemas in SA syntax these days: Python is everywhere and SA does a great job of issuing DDL creates in the correct sequence based on a dependancy sort that I would otherwise have to myself. But I think a pretty useful tool, and fairly easy to create would be to have

[sqlalchemy] Re: SQLError: (OperationalError) (2013, 'Lost connection to MySQL server during query')

2008-02-25 Thread jason kirtland
Ross Vandegrift wrote: Hello everyone, I've got a particularly perplexing case of SQLAlchemy losing SQL connections to a MySQL 4.1 database. Before you roll your eyes, I am familiar with both wait_timeout and pool_recycle! On the MySQL server, this is set to eight hours: mysql show

[sqlalchemy] weird SA + PostgreSQL with two schemas issue

2008-02-25 Thread David Gardner
Ran across a weird issue this morning, not sure if its even a SA issue, may just be PostgreSQL (8.3) being weird. I recently merged two pgsql databases into one database with two schemas, and a foreign key connecting two of the tables. he first schema is in the search path, the second is not.

[sqlalchemy] Re: weird SA + PostgreSQL with two schemas issue

2008-02-25 Thread jason kirtland
David Gardner wrote: Ran across a weird issue this morning, not sure if its even a SA issue, may just be PostgreSQL (8.3) being weird. I recently merged two pgsql databases into one database with two schemas, and a foreign key connecting two of the tables. he first schema is in the search

[sqlalchemy] Reflection + override error with SA 0.3.10 and MySQL

2008-02-25 Thread Tim Lesher
I'm using SQLAlchemy, reflecting from an existing MySQL database. I want to override two DateTime columns to provide proper created and updated timestamps (since MySQL can't handle auto-updating two TIMESTAMP columns in the same row). According to the SA docs, this should work; however, when I

[sqlalchemy] Re: Reflection + override error with SA 0.3.10 and MySQL

2008-02-25 Thread jason kirtland
Tim Lesher wrote: I'm using SQLAlchemy, reflecting from an existing MySQL database. I want to override two DateTime columns to provide proper created and updated timestamps (since MySQL can't handle auto-updating two TIMESTAMP columns in the same row). According to the SA docs, this should

[sqlalchemy] Re: Reflection + override error with SA 0.3.10 and MySQL

2008-02-25 Thread Michael Bayer
On Feb 25, 2008, at 9:03 PM, Tim Lesher wrote: I'm using SQLAlchemy, reflecting from an existing MySQL database. I want to override two DateTime columns to provide proper created and updated timestamps (since MySQL can't handle auto-updating two TIMESTAMP columns in the same row).