我有以下几点:
from sqlalchemy import create_engine
engine1 = create_engine('mysql://user:password@host1/schema', echo=True)
engine2 = create_engine('mysql://user:password@host2/schema')
connection1 = engine1.connect()
connection2 = engine2.connect()
table1 = connection1.execute("select * from table1")
table2 = connection2.execute("select * from table2")
现在我想把这个table1
中的所有条目插入connection2
中相同的空表table2
。你知道吗
我怎样才能做到?你知道吗
我还可以从table1
中创建一个dict
,然后将它插入table2
。正如我从sqlalchemy的文档中了解到的,有一种方法可以做到这一点,但是这里的示例假设您创建一个全新的表,以便使用new_table.insert()
插入其中。它对我现有的表不起作用。你知道吗
谢谢
目前没有回答
相关问题 更多 >
编程相关推荐