Helper funcs and tools for working with SQL in mysql, postgresql, and more
Project description
About
This is meant to be a simple way to explore a postgresql/mysql/sqlite database and get data out (super light wrapper to SQLAlchemy).
Connect with DB url in the following formats:
postgresql://someuser:somepassword@somehost[:someport]/somedatabase
mysql://someuser:somepassword@somehost[:someport]/somedatabase
sqlite:///somedb.db
Note: This package uses pymysql driver for connecting to mysql. Urls that start with mysql:// will automatically be changed to use mysql+pymysql://.
Install
Ensure the pg_config executable is on the system
$ sudo apt-get install -y libpq-dev or $ brew install postgresql
Then install sql-helper
$ pip3 install sql-helper
Usage
In [1]: from sql_helper import SQL In [2]: sql = SQL('postgresql://someuser:somepassword@somehost/somedatabase') In [3]: table_names = sql.get_tables() In [4]: results = sql.execute('SELECT ...')
Extra
Install sqlalchemy-redshift wherever you installed sql-helper
$ venv/bin/pip3 install sqlalchemy-redshift
Connect with DB url in the following format:
redshift+psycopg2://someuser:somepassword@somehost/somedatabase
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for sql_helper-0.0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e73668e3524b5eb5e387baa0877a16ea85d98a8fe9f0a33997d9b16fb03ff592 |
|
MD5 | 63a61f83f8634bfe9c75e186f04c11ae |
|
BLAKE2b-256 | 1a68945d4c7a6169dd246804ac736dd6d49deca49a14aaa7e72de749b32bd9f4 |