-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Bayer ha scritto:
> [...]
> from sqlalchemy import schema, types, sql, create_engine
> 
> metadata = schema.MetaData()
> test = schema.Table(
>     'test', metadata,
>     schema.Column('x', types.Integer, primary_key=True)
>     )
> 
> engine = create_engine('sqlite://')
> 
> subquery = sql.exists(test.select().as_scalar())
> clause = sql.case([(True, subquery.select().as_scalar)])
> query = clause.select()
> 
> engine.execute(query)
> 
>> its more SQLA not warning you about an argument it doesn't like and then
>> it leading into problems.  it should raise an error earlier.   basically
>> exists() is like a select() and accepts the list of column expressions as
>> a list.   if you were to pass your select inside of a [], you'd get a
>> valid SQL expression, though with two levels of "select". 
>> sql.exists([test])  or exists().select_from(test) would be more effective.
> 

Ok, thanks.

However, now I'm not sure to understand the example here:
http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?highlight=exists#sqlalchemy.sql.expression.exists

# use on an existing select()
s = select([table.c.col1]).where(table.c.col2==5)
s = exists(s)



Regards  Manlio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkth+0EACgkQscQJ24LbaUTf0QCfTWwPMRvTYMAH7R/mU2CCb2fQ
DaYAn0EoxWUCkFv8e/omK0A+tx8MY2S0
=i3I0
-----END PGP SIGNATURE-----

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to