9 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Single table inherit...
FromSent OnAttachments
Gaetan de Menten27 Jul 2007 05:34.py
Michael Bayer27 Jul 2007 08:42 
Gaetan de Menten27 Jul 2007 13:03 
Michael Bayer27 Jul 2007 13:31 
Gaetan de Menten27 Jul 2007 14:06 
jason kirtland27 Jul 2007 14:51 
sdob...@sistechnology.com27 Jul 2007 14:52 
Michael Bayer27 Jul 2007 22:23 
Gaetan de Menten27 Jul 2007 23:43 
Subject:[sqlalchemy] Re: Single table inheritance and mapping against a selectable
From:Gaetan de Menten (gdem@gmail.com)
Date:07/27/2007 01:03:10 PM
List:com.googlegroups.sqlalchemy

On 7/27/07, Michael Bayer <mike@zzzcomputing.com> wrote:

On Jul 27, 2007, at 8:34 AM, Gaetan de Menten wrote:

First, it complained there was no alias, while I *think* aliases should only be necessary when the query is used in a subquery, but anyway, after giving it its alias, it still doesn't work: I can't save any data. Worse, it doesn't complain in any way, it's just that no insert is issued to the database. I suspect a limitation in SQLAlchemy (ie no inserts when there isn't at least one complete table in the selectable or something of the like), but it might be something I'm doing wrong. Any idea?

normally i know what this is but in this case its a bug with select traversal...what youre doing should work fine (though its a sucky workaround for what you want). try it with 0.3 and it works fine.

Oh. Ok. Works fine now, thanks for the quick fix!

BTW: it's probably related to the fact the generated select query is:

SELECT subset.id AS subset_id, subset.data AS subset_data FROM (SELECT common.id AS id, common.data AS data FROM common) AS subset ORDER BY subset.oid

while I'd like to be able to do is simply:

SELECT common.id AS common_id, common.data AS common_data FROM common ORDER BY subset.oid

so do you just want "explicit_columns=True" so that no auto-grabbing of columns occurs ?

I don't know exactly what I want (or maybe it's just I don't care how it's done). It's just that I found it suboptimal that in some cases the columns you select are "embedded" in the from clause while what you want is modify what is selected "before" the from clause, whether this is columns or more complex expressions.