{"id":22204240,"url":"https://github.com/bilbottom/database-exporter","last_synced_at":"2025-03-25T02:43:39.459Z","repository":{"id":264203881,"uuid":"892528306","full_name":"Bilbottom/database-exporter","owner":"Bilbottom","description":"Export database query result sets.","archived":false,"fork":false,"pushed_at":"2025-01-08T20:55:30.000Z","size":48,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T03:44:23.962Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Bilbottom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-22T09:33:35.000Z","updated_at":"2025-01-08T20:55:32.000Z","dependencies_parsed_at":"2025-01-08T22:06:39.824Z","dependency_job_id":"6d6175d2-b72a-4ea0-870f-5a1b52bd0b22","html_url":"https://github.com/Bilbottom/database-exporter","commit_stats":null,"previous_names":["bilbottom/database-exporter"],"tags_count":1,"template":false,"template_full_name":"Bilbottom/python-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bilbottom%2Fdatabase-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bilbottom%2Fdatabase-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bilbottom%2Fdatabase-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bilbottom%2Fdatabase-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bilbottom","download_url":"https://codeload.github.com/Bilbottom/database-exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245388752,"owners_count":20607163,"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":[],"created_at":"2024-12-02T17:16:36.380Z","updated_at":"2025-03-25T02:43:39.442Z","avatar_url":"https://github.com/Bilbottom.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n[![Python](https://img.shields.io/badge/Python-3.11+-blue.svg)](https://www.python.org/downloads/release/python-3110/)\n[![Poetry](https://img.shields.io/endpoint?url=https://python-poetry.org/badge/v0.json)](https://python-poetry.org/)\n[![tests](https://github.com/Bilbottom/database-exporter/actions/workflows/tests.yaml/badge.svg)](https://github.com/Bilbottom/database-exporter/actions/workflows/tests.yaml)\n[![coverage](coverage.svg)](https://github.com/dbrgn/coverage-badge)\n[![GitHub last commit](https://img.shields.io/github/last-commit/Bilbottom/database-exporter)](https://shields.io/badges/git-hub-last-commit)\n\n[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Bilbottom/database-exporter/main.svg)](https://results.pre-commit.ci/latest/github/Bilbottom/database-exporter/main)\n\n\u003c/div\u003e\n\n---\n\n# Database Exporter 📦📤\n\nExport database query result sets.\n\nThis tool is database-agnostic -- just provide a class that connects to your database with an execute method, and the query whose result set you want to export.\n\n## Installation ⬇️\n\nWhile in preview, this package is only available from GitHub:\n\n```\npip install git+https://github.com/Bilbottom/database-exporter@v0.0.1\n```\n\nThis will be made available on PyPI once it's ready for general use.\n\n## Usage 📖\n\nThe package exposes functions which require a database connection/cursor class that implements an `execute` method.\n\n### SQLite Example\n\n\u003e Official documentation: https://docs.python.org/3/library/sqlite3.html\n\n```python\nimport pathlib\nimport sqlite3\n\nimport database_exporter\n\n\ndef main() -\u003e None:\n    db_conn = sqlite3.connect(\":memory:\")  # Or a path to a database file\n    query_path = pathlib.Path(\"path/to/query.sql\")\n    database_exporter.query_to_csv(\n        conn=db_conn,\n        query=query_path.read_text(\"utf-8\"),\n        filepath=query_path.with_suffix(\".csv\"),\n    )\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n### Snowflake Example\n\n\u003e Official documentation: https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example\n\n```python\nimport pathlib\n\nimport database_exporter\nimport snowflake.connector  # snowflake-connector-python\n\n\n# This dictionary is just for illustration purposes, and\n# you should use whatever connection method you prefer\nCREDENTIALS = {\n    \"user\": \"XXX\",\n    \"password\": \"XXX\",\n    \"account\": \"XXX\",\n    \"warehouse\": \"XXX\",\n    \"role\": \"XXX\",\n    \"database\": \"XXX\",\n}\n\n\ndef main() -\u003e None:\n    db_conn = snowflake.connector.SnowflakeConnection(**CREDENTIALS)\n    query_path = pathlib.Path(\"path/to/query.sql\")\n    with db_conn.cursor() as cursor:\n        database_exporter.query_to_csv(\n            conn=cursor,\n            query=query_path.read_text(\"utf-8\"),\n            filepath=query_path.with_suffix(\".csv\"),\n        )\n    db_conn.close()\n\n\nif __name__ == \"__main__\":\n    main()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbilbottom%2Fdatabase-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbilbottom%2Fdatabase-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbilbottom%2Fdatabase-exporter/lists"}