我试图将数据从postgres复制到db2。只是一张完整的表格。
我发现了these指令,并且正在关注它们,但是他们在db2端失败了。
目前我正在做:
engine_pstgrs._metadata = MetaData(bind=engine_pstgrs)
engine_pstgrs._metadata.reflect(engine_pstgrs)
table_one = Table('table_one', engine_pstgrs._metadata, schema='prod_schema')
print("Got prod_schema.table_one")
#Create new table
engine_db2._metadata = MetaData(bind=engine_db2)
new_pages = Table('new_pages', engine_db2._metadata, schema='mru')
print("Created new table")
for column in table_one.columns:
print("Column appended to new table")
new_pages.append_column(column.copy())
new_pages.create()
我收到错误:
(ibm_db_dbi.ProgrammingError) ibm_db_dbi::ProgrammingError: Statement Execute Failed: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token ")" was found following "TABLE MRU.new_pages (". Expected tokens may include: "<table_element_list>". SQLSTATE=42601 SQLCODE=-104 [SQL: '\nCREATE TABLE mru.new_pages (\n)\n\n']
我愿意尝试另一种方式(即熊猫),但我没有看到如何在可持续的时间内这样做(桌子非常大)