[sqlalchemy] Re: error compile

2007-03-16 Thread Jose Soares
Ok, now it works, thank you Michael, jo Michael Bayer ha scritto: > put "correlate=False" in your subquery. > > On Mar 16, 2007, at 12:43 PM, Jose Soares wrote: > > >> Hi, >> Seems that SA compiles in a wrong way my query... >> >> In [9]: sql=select([UnitaAziendale.c.id]) >> >> In [10]: subve

[sqlalchemy] Re: error compile

2007-03-16 Thread Jose Soares
Sébastien LELONG ha scritto: >> As you can see the from_obj of subselect is wrong, the FROM should be: >> >> FROM azienda_veterinario, unita_aziendale >> > > OK, I see... You probably mean that since your sub-select occurs on two > tables, those have to be present in the FROM clause. I've te

[sqlalchemy] Re: error compile

2007-03-16 Thread Michael Bayer
put "correlate=False" in your subquery. On Mar 16, 2007, at 12:43 PM, Jose Soares wrote: > > Hi, > Seems that SA compiles in a wrong way my query... > > In [9]: sql=select([UnitaAziendale.c.id]) > > In [10]: subvet = select([azienda_veterinario.c.id_unita_aziendale], >: and_(

[sqlalchemy] Re: error compile

2007-03-16 Thread Sébastien LELONG
> As you can see the from_obj of subselect is wrong, the FROM should be: > > FROM azienda_veterinario, unita_aziendale OK, I see... You probably mean that since your sub-select occurs on two tables, those have to be present in the FROM clause. I've tested this kind on query (select a from A whe

[sqlalchemy] Re: error compile

2007-03-16 Thread Jose Soares
Sébastien LELONG ha scritto: >> Seems that SA compiles in a wrong way my query... >> > > Can't what's wrong is happening... subvet appers to be a sub-select, so > probably SA made some optimizations. You should print the whole query (print > sql) and not the sub-query (as in your code: prin

[sqlalchemy] Re: error compile

2007-03-16 Thread Sébastien LELONG
> Seems that SA compiles in a wrong way my query... Can't what's wrong is happening... subvet appers to be a sub-select, so probably SA made some optimizations. You should print the whole query (print sql) and not the sub-query (as in your code: print subvet) to check if your query is actually