我在AWS服务器端点中有两个PostgreSQL数据库db1=source database和db2=destination database。对于db1,我只有读取权限,对于db2,我同时拥有读取和写入权限。db1是生产数据库有一个名为'公共采购'我的任务是从'公共采购'table indb1到'to be new created table'indb2(我将该表称为'public.u副本'). 每次我运行脚本来执行这个操作时,目标表public.u副本'indb2需要在不完全重新加载表的情况下进行更新。你知道吗
我的问题是怎样才能更有效地完成这项任务。我在网上做了很多研究,发现可以通过使用“psycopg2”模块将Python连接到PostgreSQL来实现。我对Python不是很精通,如果有人能帮我指出StackOverflow中的链接,在那里可以回答类似的问题,或者指导我可以做什么,如何实现,或者我可以参考的任何特定教程,那会有很大的帮助吗?提前谢谢。你知道吗
PostgreSQL版本:9.5, PostgreSQL GUI使用:pgadmin 3, 安装的Python版本:3.5
虽然使用python可以做到这一点,但我建议您首先研究Postgres自己的模块Postgres\u fdw,如果您可以使用它的话:
有关postgres docs的详细信息,特别是在设置之后,您可以:
为了简化设置,最好使用readonly db作为外部db。你知道吗
相关问题 更多 >
编程相关推荐