简体   繁体   English

如何使用python将CSV数据转储到postgresql表中

[英]how to dump CSV data into postgresql table using python

I have CSV file whose data i need to dump into postgresql table using python script.Also need to create a dynamic table in postrgresql. 我有一个CSV文件,我需要使用python脚本将其数据转储到postgresql表中,还需要在postrgresql中创建一个动态表。

Help me if know any ready made tool or the conventional way . 如果知道任何现成的工具或常规方法,请帮助我。

Regards, 问候,

psycopg2 offers support for the COPY command, which is what you'll want to use. psycopg2提供对COPY命令的支持,这就是您要使用的命令。

See Using COPY in the psycopg2 docs . 请参见psycopg2文档中的“使用COPY You'll want to use COPY ... WITH (FORMAT CSV) . 您将要使用COPY ... WITH (FORMAT CSV)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM