Makes your SQL readable.
Project description
Makes your SQL readable.
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 {py,sql}] [-r] [--no-semicolon]
paths [paths ...]
positional arguments:
paths
optional arguments:
-h, --help show this help message and exit
--types {py,sql} Process given file types. Default value is "py".
-r, --recursive Process files found in subdirectories.
--no-semicolon Try to detect SQL queries with no trailing semicolon.
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.4.0.tar.gz
(10.7 kB
view hashes)
Built Distribution
Close
Hashes for format_sql-0.4.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ac8fc8511338eb964574aa925257811141233814d5b11d0393a67d59292623c |
|
MD5 | 0b1f9aeb73b7f1fb5a657eebc26c0f24 |
|
BLAKE2b-256 | fccad256223186418d24afa24270eb502ca2d188caf060882b6757154d92fc18 |