Makes your SQL readable.
Project description
Makes your SQL readable.
https://paetzke.me/static/images/format-sql.gif
An example:
sql = """ SELECT country, product, SUM(profit) FROM
sales left join x on x.id=sales.k GROUP BY country,
product having f > 7 and fk=9 limit 5; """
Will result in:
sql = """
SELECT
country,
product,
SUM(profit)
FROM
sales
LEFT JOIN x ON
x.id = sales.k
GROUP BY
country,
product
HAVING
f > 7
AND fk = 9
LIMIT 5; """
Install format-sql via pip:
$ pip install format-sql
You can then just call format-sql with files and directories:
$ format-sql -h
usage: format-sql [-h] [--types TYPES] [-r] [--no-semicolon] [--version]
[--debug]
paths [paths ...]
positional arguments:
paths
optional arguments:
-h, --help show this help message and exit
--types TYPES Only process these given file types.
-r, --recursive Process files found in subdirectories.
--no-semicolon Try to detect SQL queries with no trailing semicolon.
--version show program's version number and exit
--debug Print available debug information.
For example:
$ format-sql my-file.py
Or recursively with directory:
$ format-sql -r my-directory/
You can try format-sql online: https://paetzke.me/format-sql.
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
format-sql-0.5.0.tar.gz
(10.4 kB
view hashes)
Built Distribution
Close
Hashes for format_sql-0.5.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da2648fa93b5e4f5063a44d64b69e0d48b8b2ea7974993b42c419deeb5d0c387 |
|
MD5 | 372119ae4d385bb2174a4a4fed9859d0 |
|
BLAKE2b-256 | f178676c7b4c953f93c33aa4a7d09ae67f311fd4322b5f7e8b47fb6b9e5d657b |