I have a use case where detail data is collected during operation then copied periodically to a history table. In SA, tables look something like this:
#history data history = Table('history', metadata, Column('id', Integer, primary_key=True), Column('naturalkey', String, unique=True, nullable=False), Column('data', String, nullable=False) ) #daily detail data detail = Table('detail', metadata, Column('id', Integer, primary_key=True), Column('naturalkey', String, unique=True), Column('data', String, nullable=False) ) Copying the data using SQL can be accomplished in one statement by inserting into history the data selected from detail. Using SA I can accomplish this using text() to construct a statement stmt = text("""INSERT INTO history (naturalkey, data) SELECT naturalkey, data FROM detail""") conn.execute(stmt) Is there some way to construct the statement using higher level construct than text()? For efficiency, I would want to get the same SQL generated, not a series of inserts or even an executemany() construct. I have tried a couple of variations combining history.insert() and detail.select() without success. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---