python - 自动将 csv 转储到新的 Postgres 表中
问题描述
我有数千个 csv,每个 csv 有超过 10000 条记录。我正在寻找以最少的时间和精力将这些数据转储到 Postgres DB 表中的最有效方法。
解决方案
COPY is usually the best solution. Depends of your constraints.
COPY table_name FROM 'path_readable_by_postgres/file.cvs';
And you can cat
your files in a big one to import data quickly.
Look ta https://www.postgresql.org/docs/current/static/sql-copy.html for more details.
推荐阅读
- python - Python setuptools 无法在 user_config_dir 中安装 data_files
- php - 将子文件夹指向根目录而不更改 URL
- java - 如何从 Java 8 Streams 中获取 Inputstream?
- ios - 如何上传使用 Flutter 开发的 dsyms 文件?
- bash - find exec ls : 没有这样的文件或目录
- c - 使用堆栈的连接组件标签
- git - 解析 .gitmodules 中引用的存储库
- css - 具有响应式内容的黄金布局
- reactjs - React Typescript:@types/react-router-dom 与 react-router-dom
- javascript - 肯定需要这个 CSS 代码吗?