我成功地从pandas数据框将记录插入PostGREs表。 代码如下所示
try:
engine = create_engine('postgresql://***CONNECTION***')
connection = engine.raw_connection()
dataframe1.to_sql('table1', con=engine, schema='public', index=False, if_exists='append')
except (Exception) as error :
print ("Error while connecting to PostgreSQL", error)
finally:
#closing database connection.
if(connection):
connection.close()
print("PostgreSQL connection is closed")
我希望将执行统计数据写入日志文件。我要查找插入、拒绝的记录数、执行时间等
非常感谢您的任何帮助/建议
目前没有回答
相关问题 更多 >
编程相关推荐