On Jan 26, 2011, at 6:10 PM, A.M. wrote:

> 
> Thanks for the prodding- I figured out my bug. Here is sample code that 
> demonstrates a little surprise. 
> 
> First, this code that emits:
> BEGIN (implicit)
> SELECT 1
> ROLLBACK
> 
> =========================
> from sqlalchemy.engine import create_engine
> from sqlalchemy.orm.session import sessionmaker
> from sqlalchemy.orm import scoped_session
> from sqlalchemy.schema import DDL
> 
> engine = create_engine('postgresql://localhost/test',echo=True)
> session = scoped_session(sessionmaker(bind=engine))
> 
> DDL("SELECT 1").execute(bind=session)

that's some surprise - a Session was never intended to be used as a "bind" and 
that argument on DDL.execute() is documented as expecting a Connection or 
Engine.  Its kind of just coincidence it happens to call .execute() on the 
thing it gets and it "works".    Dynamic typing FTW I guess


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@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