Convert SQL to most human readable format
Project description
readsql
Convert SQL to most human readable format
Installation
pip install readsql
Usage
- Format SQL code provided in command line
readsql <SQL_STRING> -s- e.g.,
readsql 'select sushi from tokyo' -s - prints out
SELECT sushi FROM tokyo
- Format an SQL file
readsql <FILE_PATH>- e.g.,
readsql sql_example.sql - given a Python file (ends with
.py), it looks for variablesqueryand formats their insides - variable to represent SQL code can be change with
-pyoption - e.g.,
readsql sql_in_python_variable_example.py -py sql - given a Python file with this code
def get_query():
limit = 6
sql = f"SELEct speed from world where animal='dolphin' limit {limit}"
return sql
converts it to
def get_query():
limit = 6
sql = f"SELECT speed FROM world WHERE animal='dolphin' LIMIT {limit}"
return sql
Development
Having the repo cloned
python readsql tests/sql_example.sqlconverts example SQL code to easier readable formatpython readsql tests/sql_in_python_example.pyconverts example SQL code in Python (it looks for variablesquery)- we can change the SQL variable with
-pyoptionpython readsql tests/sql_in_python_variable_example.py -py sql python readsql "select gold from mine" -stakes the"select gold from mine"string as input and outputs it formatted
Testing
Have pytest installed and run pytest -v (-v stands for verbose)
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 Distribution
readsql-0.1.0.tar.gz
(3.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file readsql-0.1.0.tar.gz.
File metadata
- Download URL: readsql-0.1.0.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.7.7 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1769a79104502c31bbbe356be61571ae212b37fc68baa05159fa2466e519a27f
|
|
| MD5 |
84b132c3164ec3d6e61ec6d947473fe5
|
|
| BLAKE2b-256 |
48b33b9cddc1934560ed227434d6c3693e187af6bd3089c97ee6a46d04120eed
|
File details
Details for the file readsql-0.1.0-py3-none-any.whl.
File metadata
- Download URL: readsql-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.3 CPython/3.7.7 Darwin/18.7.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db118afd713e638dc2c92b473c9b35aafe014c15e4e1355f20e95ae04a957f0b
|
|
| MD5 |
de0d2c7c4c4fd272c4b3fbd79fb9e513
|
|
| BLAKE2b-256 |
c85f1753167eecc28b8aae7ab715d5210a4d44c30dca6b5fa35a26dd0c0e50b9
|