{"id":15104894,"url":"https://github.com/abeltavares/postql","last_synced_at":"2026-01-19T13:01:22.810Z","repository":{"id":224982659,"uuid":"756898339","full_name":"abeltavares/PostQL","owner":"abeltavares","description":"Python library and command-line interface (CLI) tool for interacting with PostgreSQL databases, providing simplified database management, query execution, and result export functionalities.","archived":false,"fork":false,"pushed_at":"2024-03-06T19:41:53.000Z","size":730,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-31T06:46:08.272Z","etag":null,"topics":["cli","command-line-interface","data-analysis","data-engineering","data-export","data-management","data-processing","data-visualization","database","database-administration","database-tools","etl","oop","postgres","postgresql","psycopg2","python","sql","sqlalchemy","wrapper"],"latest_commit_sha":null,"homepage":"https://abeltavares.github.io/PostQL/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abeltavares.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":"2024-02-13T14:24:22.000Z","updated_at":"2024-03-01T17:05:34.000Z","dependencies_parsed_at":"2024-03-05T06:44:45.977Z","dependency_job_id":"0c465a35-ce82-4036-8f21-facebc2ce4e4","html_url":"https://github.com/abeltavares/PostQL","commit_stats":{"total_commits":5,"total_committers":2,"mean_commits":2.5,"dds":"0.19999999999999996","last_synced_commit":"1b48f3e63e7a1583d9a218bfd64929d729fea439"},"previous_names":["abeltavares/postql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/abeltavares/PostQL","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeltavares%2FPostQL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeltavares%2FPostQL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeltavares%2FPostQL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeltavares%2FPostQL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abeltavares","download_url":"https://codeload.github.com/abeltavares/PostQL/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abeltavares%2FPostQL/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28568833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-19T12:50:50.164Z","status":"ssl_error","status_checked_at":"2026-01-19T12:50:42.704Z","response_time":67,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["cli","command-line-interface","data-analysis","data-engineering","data-export","data-management","data-processing","data-visualization","database","database-administration","database-tools","etl","oop","postgres","postgresql","psycopg2","python","sql","sqlalchemy","wrapper"],"created_at":"2024-09-25T20:03:38.976Z","updated_at":"2026-01-19T13:01:22.794Z","avatar_url":"https://github.com/abeltavares.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PostQL\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"assets/postql.png\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/abeltavares/postql\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/GitHub-Repository-blue?logo=github\" alt=\"GitHub Repository\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://pypi.org/project/PostQL/\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/v/PostQL\" alt=\"PyPI\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/License-MIT-blue.svg\" alt=\"License\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\nPostQL is a Python library and command-line interface (CLI) tool for managing PostgreSQL databases, executing queries, exporting data and interacting with PostgreSQL databases from the command line.\n\n## Features\n\n- Connect to PostgreSQL databases and execute SQL queries interactively via the CLI.\n- Perform database management tasks such as creating, deleting databases, users, tables, etc.\n- Execute SQL queries directly from Python code using the `Postgres` class.\n- Export query results to CSV, Excel, JSON, and Parquet formats.\n- Upload exported files to Amazon S3 buckets.\n\n## Installation\n\nYou can install PostQL via pip:\n\n```bash\npip install postql\n```\n## Usage\n\n### Command Line Interface (CLI)\n\nTo use the PostQL CLI, simply run `postql` followed by the desired command. Here are some examples:\n\n```bash\n# Connect to a database and execute SQL queries interactively\npostql connect -H localhost -u postgres -P password -d my_database\n\n# Run query\nmy_database\u003e Select * from my_table\n\n# Exit the CLI\nexit\n\n```\n\n![demo](assets/postql.gif)\n\n### Python Library\n\n```python\nfrom postql import Postgres\n\n# Initialize the Postgres connection\ndb = Postgres(host=\"localhost\", port=\"5432\", user=\"postgres\", password=\"password\")\n\n# Connect to the 'bookstore' database\ndb.connect(database=\"market_data\")\n\n# Create the 'books' table\ndb.create_table(\"books\", {\n    \"id\": \"SERIAL PRIMARY KEY\",\n    \"title\": \"VARCHAR(255) NOT NULL\",\n    \"author\": \"VARCHAR(255) NOT NULL\",\n    \"price\": \"DECIMAL(10, 2) NOT NULL\",\n    \"genre\": \"VARCHAR(255)\"\n})\n\n# Create the 'orders' table\ndb.create_table(\"orders\", {\n    \"id\": \"SERIAL PRIMARY KEY\",\n    \"book_id\": \"INTEGER REFERENCES books(id)\",\n    \"quantity\": \"INTEGER NOT NULL\",\n    \"customer_name\": \"VARCHAR(255) NOT NULL\",\n    \"order_date\": \"DATE NOT NULL\"\n})\n\n# Insert sample books\ndb.insert(\"books\", {\"title\": \"The Great Gatsby\", \"author\": \"F. Scott Fitzgerald\", \"price\": 15.99, \"genre\": \"Fiction\"}).execute()\ndb.insert(\"books\", {\"title\": \"To Kill a Mockingbird\", \"author\": \"Harper Lee\", \"price\": 12.99, \"genre\": \"Fiction\"}).execute()\n\n# Insert a sample order\ndb.insert(\"orders\", {\"book_id\": 1, \"quantity\": 2, \"customer_name\": \"John Doe\", \"order_date\": \"2023-04-01\"}).execute()\n\n# Query all books\nprint(\"All books:\")\ndb.select(\"books\",[\"title\"]).execute()\n\n# Query all orders for a specific book\nprint(\"Orders for 'The Great Gatsby':\")\ndb.select(\"orders\").where({\"book_id\": 1}).execute()\n\n# Update the price of a book\ndb.update(\"books\").set({\"price\": 14.99}).where({\"id\": 1}).execute()\n\n# Export books to a CSV file\ndb.select(\"books\").to_csv(\"books.csv\")\n\n# Export orders to a CSV file\ndb.select(\"orders\").to_csv(\"orders.csv\")\n\n# Disconnect from the database\ndb.disconnect()\n```\n\n## Documentation\n\n- [Methods Documentation](docs/methods.md)\n- [CLI Documentation](docs/cli.md)\n\n## Contributing\n\nContributions are welcome! If you find any bugs or have suggestions for improvement, please open an issue or submit a pull request.\n\nThe codebase of this project follows the [black](https://github.com/psf/black) code style. To ensure consistent formatting, the [pre-commit](https://pre-commit.com/) hook is set up to run the black formatter before each commit.\n\nAdditionally, a GitHub Action is configured to automatically run the black formatter on every pull request, ensuring that the codebase remains formatted correctly.\n\nPlease make sure to run `pip install pre-commit` and `pre-commit install` to enable the pre-commit hook on your local development environment.\n\n## License \n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE.txt) for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabeltavares%2Fpostql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabeltavares%2Fpostql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabeltavares%2Fpostql/lists"}