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.3.0.tar.gz
(9.8 kB
view hashes)
Built Distribution
Close
Hashes for format_sql-0.3.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8fb082e4a0f5eb678985f060a557b12a48ccd9ef9ad7a47ea17569dce31cfbe |
|
MD5 | e137be497f4dae919204f99a7bac9553 |
|
BLAKE2b-256 | 0b2362063a939efd40d0d2216d70f26d6d301e76f5813176b5fe432556f520a2 |