This project has been archived by its maintainers, and is no longer receiving any updates.
csv_pg
A Python module to import/export CSV files efficiently to/from a Postgresql database.
Key features:
- Detect CSV file dialect automatically
- Create target database table automatically
- Handle localized date/time and decimal formats
- Filter CSV file rows during import
Usage examples
Installation:
pip install csv_pg
Import CSV file tests/samples/misc.csv to table misc (recreate table if already exists):
python -m csv_pg from_csv tests/samples/misc.csv --recreate
Export table misc to CSV file misc.local.csv (recreate file if already exists):
python -m csv_pg to_csv misc.local.csv misc --recreate
Contributors guidelines
Prepare environment:
# Debian: sudo apt install libpq-dev
python -m venv .venv # Debian: python3 -m venv .venv
.\.venv\Scripts\activate # Linux: source .venv/bin/activate
pip install .[dev]
Create test database:
sudo -u postgres createdb -E UTF8 -l fr_FR.UTF8 -T template0 test_csv_pg
Run tests:
python -m unittest
Alternatives / inspirations
-
- Have to manually call Postgresql COPY command?
-
- Depends on Django, and force import to a Django model (cannot simply load to a temporary table)
- No filter during import?
Metadata
Release files for csv-pg 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| csv_pg-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for csv_pg-0.1.0-py3-none-any.whl |
Release files / csv_pg-0.1.0-py3-none-any.whl
| Download URL | csv_pg-0.1.0-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78cd622ce39cc4d0b40f3de367288c69e253102270cda738ce343d5af735edc8
|
|
BLAKE2b-256 checksum How to use checksums |
a9ded05cbe9e1d48eab67dc50a9bccc5690212e686dd4349e7137efe2b17ddae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.2
|
Security for csv-pg 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.