I see that, thanks for the pointer!
On Wed, May 8, 2013 at 10:22 AM, Michael Bayer <mike...@zzzcomputing.com>wrote: > > On May 8, 2013, at 9:45 AM, Haoyi Li <haoyi...@gmail.com> wrote: > > It creates an in memory database, initializes it, reflects to get its > tables out, and then performs some queries. > > One thing that's I've noticed is the fact that I have to specify the > engine twice: once at the top, when I create the metadata which will > contain all the tables, and once at the bottom, when I actually perform the > query. > > In theory, the tables could already know what metadata and what engine > they belong to; is it possible to replace the > > > results = engine.execute(query).fetchall() > > > with something like > > > results = query.execute().fetchall() > > > > Or similar? It's not a huge deal, but it just bugs me that I have to > specify something twice when the computer should know what I want (in this > case, what engine I want to use to query), and I was wondering if there was > a way to avoid this. > > > > there's a feature called "bound metadata" that gets you exactly that > behavior, it's described here: > http://docs.sqlalchemy.org/en/rel_0_8/core/connections.html#connectionless-execution-implicit-execution. > > note however that it makes transactional control more difficult to achieve > (each statement with engine.execute() or stmt.execute() is normally > autocommit). > > > > > -- > You received this message because you are subscribed to a topic in the > Google Groups "sqlalchemy" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sqlalchemy/FwZUK2nI9M8/unsubscribe?hl=en > . > To unsubscribe from this group and all its topics, 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?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.