psql2csv
A library and a CLI to download PostgreSQL schemas and tables
Installation
pip3 install psql2csv
Usage
CLI
To run the CLI normally, just run
psql2csv
Options:
--dbname TEXT The database name
--host TEXT URL Endpoint of the database
--user TEXT Login username
--password TEXT Login password
--all Downloads everything
--schema Downloads a schema
--table Downloads a table
--stdout Whether to print which schema and table is downloading
--help Show this message and exit.
API
There are 3 runnable functions: * download_all * download_schema * download_table
download_all
download_all(conn, output_folder=‘output’, exclude_schemas=[‘pg_toast’, ‘pg_temp_1’, ‘pg_toast_temp_1’, ‘pg_catalog’, ‘public’, ‘information_schema’], stdout=False)
Downloads all schemas and all its tables by specifying schema
conn: input connection or psql2csv.DataBase. If it’s an input connection, it’ll eventually be converted to psql2csv.DataBase class
output_folder: the name of the folder to place the data
exclude_schemas: Which schemas to exclude while downloading everything
stdout: whether to print which schema and table is downloading. True = print
download_schema
download_schema(conn, schema, output_folder=‘output’, stdout=False)
Downloads schema and its tables by specifying schema
conn: input connection or psql2csv.DataBase. If it’s an input connection, it’ll eventually be converted to psql2csv.DataBase class
schema: name of the schema to download
output_folder: the name of the folder to place the data
stdout: whether to print which schema and table is downloading. True = print
download_table
download_table(conn, schema, table, output_folder=‘output’, stdout=False)
Downloads table by specifying schema and table
conn: input connection or psql2csv.DataBase. If it’s an input connection, it’ll eventually be converted to psql2csv.DataBase class
schema: name of the schema that the table belongs to
table: name of the table to download
output_folder: the name of the folder to place the data
stdout: whether to print which table is downloading. True = print
Versions
1.1.x
Added CLI
1.0.x
First publish
Metadata
Release files for psql2csv 1.1.4
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 |
|---|---|---|---|---|
| psql2csv-1.1.4-py3-none-any.whl | Python 3 | none | any | Details for psql2csv-1.1.4-py3-none-any.whl |
Release files / psql2csv-1.1.4-py3-none-any.whl
| Download URL | psql2csv-1.1.4-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3e13cfa1fad7754e2057711785a6993a4c42f6642060dec1203b06796013e61
|
|
BLAKE2b-256 checksum How to use checksums |
90403f83db8f1acae0c6f3ea40b94c96294ae35561a03fd2c8d0a0fa6b0a384b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for psql2csv 1.1.4
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.