On Apr 17, 2013, at 3:37 PM, Randy Shults <
randy.c...@gmail.com> wrote:
> Awesome thank you.
>
> So even though the Table object is attached to the metadata that was bound to the engine that uses a mysql connection, I have to explicitly set the dialect and compile when printing out the literal sql.
OK well here the answer is "sort of". *Some* SQL constructs, essentially those that are "executable", will compile themselves according to the dialect they're associated with; basically select(), insert(), update(), delete():
from sqlalchemy import Table, Column, MetaData, create_engine, String, select
m = MetaData()
t = Table('t', m, Column('x', String))
m.bind = create_engine("mysql://")
print select([t.c.x.contains("test")])
but just the column expression, since the expression isn't by itself "executable" it doesn't spend the time searching for an Engine:
print t.c.x.contains("test")
So if you're only dealing with execute(), you should be OK. But this is why I've really de-emphasized "bound metadata" overall, just makes things more confusing.