{"id":15067283,"url":"https://github.com/joeyism/psql2csv","last_synced_at":"2026-02-02T19:32:55.396Z","repository":{"id":138023749,"uuid":"115216766","full_name":"joeyism/psql2csv","owner":"joeyism","description":"A library and a CLI to download PostgreSQL schemas and tables","archived":false,"fork":false,"pushed_at":"2017-12-24T15:37:07.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-16T03:41:40.789Z","etag":null,"topics":["cli","command-line","command-line-tool","csv","downloader","postgresql","psql","schema","sql","table"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joeyism.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-23T19:20:11.000Z","updated_at":"2017-12-24T06:10:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"e2aca101-a20c-4a00-94dd-432dcd8cceee","html_url":"https://github.com/joeyism/psql2csv","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/joeyism/psql2csv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeyism%2Fpsql2csv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeyism%2Fpsql2csv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeyism%2Fpsql2csv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeyism%2Fpsql2csv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joeyism","download_url":"https://codeload.github.com/joeyism/psql2csv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeyism%2Fpsql2csv/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260665168,"owners_count":23044267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","command-line","command-line-tool","csv","downloader","postgresql","psql","schema","sql","table"],"created_at":"2024-09-25T01:19:05.702Z","updated_at":"2026-02-02T19:32:50.374Z","avatar_url":"https://github.com/joeyism.png","language":"Python","readme":"# psql2csv\nA library and a CLI to download PostgreSQL schemas and tables\n\n# Installation\n```bash\npip3 install psql2csv\n```\n\n# Usage\n\n## CLI\nTo run the CLI normally, just run\n\n```bash\npsql2csv\n```\n\nwhich, by default, downloads the entire database of all schemas and all of its tables into a folder called `output/`. If your database is large, THIS IS NOT RECOMMENDED. To specify the details, see the options below.\n\n```bash\nOptions:\n  --dbname TEXT    The database name\n  --host TEXT      URL Endpoint of the database\n  --user TEXT      Login username\n  --password TEXT  Login password\n  --all            Downloads everything\n  --schema         Downloads a schema\n  --table          Downloads a table\n  --stdout         Whether to print which schema and table is downloading\n  --help           Show this message and exit.\n```\n\nFor example, downloading a specific table can be done by running\n\n```bash\npsql2csv --table\n```\n\nand downloading all tables in a schema can be done by running\n\n```bash\npsql2csv --schema\n```\n\n## API\n\nThere are 3 runnable functions:\n* [download_all](#download_all)\n* [download_schema](#download_schema)\n* [download_table](#download_table)\n\n\n### download_all\n**download_all**(conn, output_folder='output', exclude_schemas=['pg_toast', 'pg_temp_1', 'pg_toast_temp_1', 'pg_catalog', 'public', 'information_schema'], stdout=False)\n\nDownloads all schemas and all its tables by specifying schema\n    \n* conn: input connection or psql2csv.DataBase. If it's an input connection, it'll eventually be converted to psql2csv.DataBase class\n* output_folder: the name of the folder to place the data\n* exclude_schemas: Which schemas to exclude while downloading everything\n* stdout: whether to print which schema and table is downloading. True = print\n\n```python\nfrom psql2csv import download_all\nimport psycopg2\n\nconn = psycopg2.connect(\"dbname='dbname' user='username' host='url' password='password'\")\ndownload_all(conn)\n```\n\n### download_schema\n**download_schema**(conn, schema, output_folder='output', stdout=False)\n\nDownloads schema and its tables by specifying schema\n\n* conn: input connection or psql2csv.DataBase. If it's an input connection, it'll eventually be converted to psql2csv.DataBase class\n* schema: name of the schema to download\n* output_folder: the name of the folder to place the data\n* stdout: whether to print which schema and table is downloading. True = print\n\n```python\nfrom psql2csv import download_schema\nimport psycopg2\n\nconn = psycopg2.connect(\"dbname='dbname' user='username' host='url' password='password'\")\ndownload_schema(conn, \"schema_name\")\n```\n\n### download_table\n**download_table**(conn, schema, table, output_folder='output', stdout=False)\n\nDownloads table by specifying schema and table\n\n* conn: input connection or psql2csv.DataBase. If it's an input connection, it'll eventually be converted to psql2csv.DataBase class\n* schema: name of the schema that the table belongs to\n* table: name of the table to download\n* output_folder: the name of the folder to place the data\n* stdout: whether to print which table is downloading. True = print\n\n```python\nfrom psql2csv import download_table\nimport psycopg2\n\nconn = psycopg2.connect(\"dbname='dbname' user='username' host='url' password='password'\")\ndownload_table(conn, \"schema_name\", \"table_name\")\n```\n\n## Versions\n\n**1.1.x**\n\n* Added CLI\n\n**1.0.x**\n\n* First publish\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeyism%2Fpsql2csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoeyism%2Fpsql2csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeyism%2Fpsql2csv/lists"}