Helper funcs and tools for working with SQL in mysql or postgresql
Project description
About
This is meant to be a simple way to explore a postgresql/mysql database and get data out (super light wrapper to SQLAlchemy).
Connect with DB url in the following formats:
postgresql://someuser:somepassword@somehost/somedatabase
mysql://someuser:somepassword@somehost/somedatabase
Note: This package uses pymysql driver for connecting to mysql. Urls that start with mysql:// will automatically be changed to use mysql+pymysql://.
Install
$ 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
Ensure the pg_config executable is on the system
$ sudo apt-get install -y libpq-dev or $ brew install postgresql
Then 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.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4ed8c723215783552556afc310d1845f99e2702494b22c992cff1fb8edd3272 |
|
MD5 | 8fd5e374b60cec3a27a701552eb3ad5f |
|
BLAKE2b-256 | 0a9acf1c53e7742b040328e633a79e586e685f2e3bfe9a181a8aba18ae6e4712 |