{"id":21905068,"url":"https://github.com/kenjyco/sql-helper","last_synced_at":"2025-07-04T02:36:57.519Z","repository":{"id":34414831,"uuid":"178716343","full_name":"kenjyco/sql-helper","owner":"kenjyco","description":"Helper funcs and tools for working with SQL in mysql, postgresql, and more","archived":false,"fork":false,"pushed_at":"2024-12-02T19:10:15.000Z","size":55,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T05:43:57.111Z","etag":null,"topics":["cli","database","kenjyco","mysql","postgresql","python","sql","sqlalchemy","sqlite"],"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/kenjyco.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,"zenodo":null}},"created_at":"2019-03-31T16:56:11.000Z","updated_at":"2024-12-02T19:07:47.000Z","dependencies_parsed_at":"2025-04-15T23:43:58.773Z","dependency_job_id":null,"html_url":"https://github.com/kenjyco/sql-helper","commit_stats":{"total_commits":56,"total_committers":1,"mean_commits":56.0,"dds":0.0,"last_synced_commit":"37bf2c3c4af0e7f0be09a49e10e0376325b32462"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/kenjyco/sql-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjyco%2Fsql-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjyco%2Fsql-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjyco%2Fsql-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjyco%2Fsql-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kenjyco","download_url":"https://codeload.github.com/kenjyco/sql-helper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kenjyco%2Fsql-helper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261243248,"owners_count":23129604,"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","database","kenjyco","mysql","postgresql","python","sql","sqlalchemy","sqlite"],"created_at":"2024-11-28T16:28:28.579Z","updated_at":"2025-07-04T02:36:57.460Z","avatar_url":"https://github.com/kenjyco.png","language":"Python","readme":"## About\n\nThis is meant to be a simple way to explore a postgresql/mysql/sqlite database\nand get data out (super light wrapper to SQLAlchemy).\n\nConnect with DB url in the following formats:\n\n- `postgresql://someuser:somepassword@somehost[:someport]/somedatabase`\n- `mysql://someuser:somepassword@somehost[:someport]/somedatabase`\n- `sqlite:///somedb.db`\n\n\u003e Note: This package uses `pymysql` driver for connecting to mysql. Urls that\n\u003e start with `mysql://` will automatically be changed to use `mysql+pymysql://`.\n\n## Dependencies\n\n#### pg_config for postgresql\n\n\u003e Ensure the `pg_config` executable is on the system\n\n```\nsudo apt-get install -y libpq-dev\n```\n\nor\n\n```\nbrew install postgresql\n```\n\n#### cryptography package\n\nIf using Python 3.6, be sure to update pip to **at least version 19.3** (default pip\nis 18.1) so that the pre-compiled wheel for `cryptography` can be used.\nOtherwise, you will need to install the [rust compiler](https://www.rust-lang.org)\nso that the `cryptography` dependency can be built\n(`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y`)\n\n#### pymysql package\n\nAccording to \u003chttps://nvd.nist.gov/vuln/detail/CVE-2024-36039\u003e, pymysql versions\nbelow 1.1.1 are vulnerable to SQL injection. Version 1.1.1 is only available for\nPython 3.7+ (final version for Python 3.6 is 1.0.2; final working version for\nPython 3.5 is 0.9.3).\n\n## Install\n\n```\npip3 install sql-helper\n```\n\n## Usage\n\n```\nIn [1]: from sql_helper import SQL\n\nIn [2]: sql = SQL('postgresql://someuser:somepassword@somehost/somedatabase')\n\nIn [3]: table_names = sql.get_tables()\n\nIn [4]: results = sql.execute('SELECT ...')\n```\n\n## Extra\n\n#### [Redshift](https://aws.amazon.com/redshift/)\n\nInstall `sqlalchemy-redshift` wherever you installed `sql-helper`\n\n```\nvenv/bin/pip3 install sqlalchemy-redshift\n```\n\nConnect with DB url in the following format:\n\n- `redshift+psycopg2://someuser:somepassword@somehost/somedatabase`\n\n## Test matrix\n\n\u003e Tested with the following python versions and dependency combinations against\n\u003e postgres 13 and mysql 8.0 docker containers.\n\n```\nvenv_py3.5.10_psycopg2-binary2.8.6_pymysql0.10.1_sqlalchemy1.3.1\nvenv_py3.5.10_psycopg2-binary2.8.6_pymysql0.10.1_sqlalchemy1.3.24\nvenv_py3.5.10_psycopg2-binary2.8.6_pymysql0.9.3_sqlalchemy1.3.1\nvenv_py3.5.10_psycopg2-binary2.8.6_pymysql0.9.3_sqlalchemy1.3.24\nvenv_py3.5.10_psycopg2-binary2.8_pymysql0.10.1_sqlalchemy1.3.1\nvenv_py3.5.10_psycopg2-binary2.8_pymysql0.10.1_sqlalchemy1.3.24\nvenv_py3.5.10_psycopg2-binary2.8_pymysql0.9.3_sqlalchemy1.3.1\nvenv_py3.5.10_psycopg2-binary2.8_pymysql0.9.3_sqlalchemy1.3.24\n\nvenv_py3.6.15_psycopg2-binary2.8.6_pymysql0.10.1_sqlalchemy1.3.24\nvenv_py3.6.15_psycopg2-binary2.8.6_pymysql0.10.1_sqlalchemy1.4.54\nvenv_py3.6.15_psycopg2-binary2.8.6_pymysql0.9.3_sqlalchemy1.3.24\nvenv_py3.6.15_psycopg2-binary2.8.6_pymysql0.9.3_sqlalchemy1.4.54\nvenv_py3.6.15_psycopg2-binary2.8.6_pymysql1.0.2_sqlalchemy1.3.24\nvenv_py3.6.15_psycopg2-binary2.8.6_pymysql1.0.2_sqlalchemy1.4.54\nvenv_py3.6.15_psycopg2-binary2.9.8_pymysql0.10.1_sqlalchemy1.3.24\nvenv_py3.6.15_psycopg2-binary2.9.8_pymysql0.10.1_sqlalchemy1.4.54\nvenv_py3.6.15_psycopg2-binary2.9.8_pymysql0.9.3_sqlalchemy1.3.24\nvenv_py3.6.15_psycopg2-binary2.9.8_pymysql0.9.3_sqlalchemy1.4.54\nvenv_py3.6.15_psycopg2-binary2.9.8_pymysql1.0.2_sqlalchemy1.3.24\nvenv_py3.6.15_psycopg2-binary2.9.8_pymysql1.0.2_sqlalchemy1.4.54\n\nvenv_py3.7.17_psycopg2-binary2.9.9_pymysql1.1.1_sqlalchemy1.3.24\nvenv_py3.7.17_psycopg2-binary2.9.9_pymysql1.1.1_sqlalchemy1.4.54\nvenv_py3.7.17_psycopg2-binary2.9.9_pymysql1.1.1_sqlalchemy2.0.2\nvenv_py3.7.17_psycopg2-binary2.9.9_pymysql1.1.1_sqlalchemy2.0.36\n\nvenv_py3.8.20_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.3.24\nvenv_py3.8.20_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.4.54\nvenv_py3.8.20_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.2\nvenv_py3.8.20_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.36\n\nvenv_py3.9.20_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.3.24\nvenv_py3.9.20_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.4.54\nvenv_py3.9.20_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.2\nvenv_py3.9.20_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.36\n\nvenv_py3.10.15_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.3.24\nvenv_py3.10.15_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.4.54\nvenv_py3.10.15_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.2\nvenv_py3.10.15_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.36\n\nvenv_py3.11.10_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.3.24\nvenv_py3.11.10_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.4.54\nvenv_py3.11.10_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.2\nvenv_py3.11.10_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.36\n\nvenv_py3.12.7_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.3.24\nvenv_py3.12.7_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.4.54\nvenv_py3.12.7_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.2\nvenv_py3.12.7_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.36\n\nvenv_py3.13.0_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.3.24\nvenv_py3.13.0_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy1.4.54\nvenv_py3.13.0_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.31\nvenv_py3.13.0_psycopg2-binary2.9.10_pymysql1.1.1_sqlalchemy2.0.36\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenjyco%2Fsql-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenjyco%2Fsql-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenjyco%2Fsql-helper/lists"}