You're right. These two queries work fine. However, I don't have access to 
`location.c.id` which is why I hoped to be able to use attributes of 
`query`.

I've copied the example out of a bigger program which mixes Core and ORM 
features (hence the use of sessionmaker).

On Thursday, August 29, 2013 1:32:29 PM UTC+10, Jonathan Vanasco wrote:
>
>
> this looks a little weird to me, because it seems like you're using parts 
> of the ORM (namely sessionmaker) and the rest is the Engine.
>
> anyways, you want to address the `table.column`; the results don't exist 
> yet.
>
> you can print out any query whenever you'd like
>
> below are 2 ways to generate the query ( i stripped the db , and just 
> print it for you )
>
> -------
>
> from sqlalchemy import Table, Column, Integer, String, MetaData, 
> ForeignKey , Sequence , Boolean
> metadata = MetaData()
>
> from sqlalchemy import create_engine 
> from sqlalchemy.orm import sessionmaker
>
> from sqlalchemy.sql.expression import select
>
> location = Table('location', metadata, 
>     Column('id', Integer, Sequence('seq_location_id')),
>     Column('name', String(256), nullable=False),
>     Column('domestic', Boolean, default=False),
> )
>
>
> def test_append_whereclause_1():
>     query = select(
>         columns=[location.c.id.label('id')],
>         from_obj=location,
>         whereclause=location.c.id>50
>     )
>     query.append_whereclause(location.c.id < 100)
>     print query
>
> def test_append_whereclause_2():
>     query = select(
>         columns=[location.c.id.label('id')],
>         from_obj=location,
>         whereclause=location.c.id>50
>     ).where(location.c.id < 100)
>     print query
>
>
> test_append_whereclause_1()
> test_append_whereclause_2()
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to