Hi all,
I am trying to do a join between two tables, each residing on a separate databases.
Here is the table info for both. I have removed extraneous columns from each table.
Table A from DB 1:
class Host(Base):
__tablename__ = 'hosts'
__table_args__ = {'mysql_engine': 'InnoDB'}
id = Column(u'HostID', INTEGER(), primary_key=True)
hostname = Column(String(length=30))
Table B from DB 2:
class ssh_host_keys(Base):
__tablename__ = 'ssh_host_keys'
__table_args__ = {'mysql_engine': 'InnoDB'}
hostname = Column(VARCHAR(30), primary_key=True)
sha256 = Column(CHAR(64))
I would like to use the sqlalchemy orm to do something like the following query:
SELECT hostname, sha256 FROM hosts LEFT JOIN ssh_host_keys ON ssh_host_keys.hostname == hosts.hostname
I did some searching and did find
https://www.mail-archive.com/sqlal...@googlegroups.com/msg14445.html, but there wasn't enough details for me to get it working (I am a sqlalchemy novice).
Is what I want to do even possible with sqlalchemy?
Thanks,
Brian