{"id":19190248,"url":"https://github.com/macktireh/postgres-to-csv","last_synced_at":"2026-05-04T17:36:43.374Z","repository":{"id":207758310,"uuid":"720020156","full_name":"Macktireh/Postgres-to-CSV","owner":"Macktireh","description":"This Python script connects to a PostgreSQL database, fetches data from a specified table, and exports the data to a CSV file. Additionally, it saves images stored as base64 strings in the database to individual image files.","archived":false,"fork":false,"pushed_at":"2023-11-17T12:16:22.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T03:46:44.881Z","etag":null,"topics":["database","export-csv","postgresql","python"],"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/Macktireh.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-17T12:04:59.000Z","updated_at":"2023-11-17T12:17:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"22c3896a-0512-467c-8ca4-bae0bf9e3e30","html_url":"https://github.com/Macktireh/Postgres-to-CSV","commit_stats":null,"previous_names":["macktireh/postgres-to-csv"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Macktireh/Postgres-to-CSV","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macktireh%2FPostgres-to-CSV","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macktireh%2FPostgres-to-CSV/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macktireh%2FPostgres-to-CSV/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macktireh%2FPostgres-to-CSV/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Macktireh","download_url":"https://codeload.github.com/Macktireh/Postgres-to-CSV/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Macktireh%2FPostgres-to-CSV/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32618230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["database","export-csv","postgresql","python"],"created_at":"2024-11-09T11:33:29.583Z","updated_at":"2026-05-04T17:36:43.351Z","avatar_url":"https://github.com/Macktireh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostgreSQL Data Exporter\n\n## Description\nThis Python script connects to a PostgreSQL database, fetches data from a specified table, and exports the data to a CSV file. Additionally, it saves images stored as base64 strings in the database to individual image files.\n\n## Configuration\n\n### Prerequisites\n- Python 3.10 or higher\n- PostgreSQL database with the required table\n- Python packages listed in `requirements.txt`\n\n### Installation\n1. Clone the repository:\n\n    ```bash\n    git clone https://github.com/yourusername/your-repository.git\n    cd your-repository\n    ```\n\n2. Install dependencies:\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n3. Rename the project file `.env.example` to `.env` and set the following environment variables:\n\n    ```env\n    POSTGRES_DB=your_database_name\n    POSTGRES_USER=your_database_user\n    POSTGRES_PASSWORD=your_database_password\n    POSTGRES_HOST=your_database_host\n    POSTGRES_PORT=your_database_port\n\n    PGADMIN_DEFAULT_EMAIL=xxx@example.com\n    PGADMIN_DEFAULT_PASSWORD=xxx\n    ```\n\n## Usage\n\n1. Run the script:\n\n    ```bash\n    python main.py\n    ```\n\n    This will connect to the PostgreSQL database, fetch data from the specified table, and export it to a CSV file (`output.csv`) in the project root. Image files will be saved in the `images` directory.\n\n2. Customize SQL Query (Optional):\n\n    Edit the SQL query in the `DataProcessor` class within `main.py` to fetch data based on your specific requirements:\n\n    ```python\n    # Customize your SQL query here\n    cur.execute(\"SELECT * FROM your_schema.your_table\")\n    ```\n\n    Replace `your_schema` and `your_table` with your specific schema and table names.\n\n3. View the Output:\n\n    The exported CSV file (`output.csv`) will contain the selected data columns. Image files will be saved in the `images` directory with filenames generated based on the first two columns of the fetched data.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacktireh%2Fpostgres-to-csv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacktireh%2Fpostgres-to-csv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacktireh%2Fpostgres-to-csv/lists"}