Jonathan Vanasco <jonat...@findmeon.com> wrote:
> > > On Tuesday, January 20, 2015 at 5:34:27 PM UTC-5, Brian Glogower wrote: > > Thanks for the idea. Do you have an example? > > I don't have a personal example handle, but from the docs... > > http://docs.sqlalchemy.org/en/rel_0_9/orm/tutorial.html#using-literal-sql > > >>> session.query(User).from_statement( > ... text("SELECT * FROM users where name=:name")). > \ > > ... params(name='ed').all() > [<User(name='ed', fullname='Ed Jones', password='f8s7ccs')>] > > > So you should be able to do something like: > > query = Session.query(Host)\ > .from_statement( > sqlaclhemy.text("SELECT hostname, sha256 FROM DATABASE1.hosts LEFT > JOIN DATABASE2.ssh_host_keys ssh_host_keys ON ssh_host_keys.hostname == > hosts.hostname) > ) why is text() needed here? these could be the Table objects set up with “schema=‘schema name’” to start with, then you’d just do the join with query.join(). -- 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/d/optout.