format-sql is a tool to format SQL in your Python strings!
Project description
format-sql is a tool to format SQL in your Python strings!
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 [TYPES ...]]] [-r] [--no-semicolon]
paths [paths ...]
positional arguments:
paths
optional arguments:
-h, --help show this help message and exit
--types [TYPES [TYPES ...]]
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.
Copyright (c) 2014, Friedrich Paetzke (paetzke@fastmail.fm). All rights reserved.
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.0.2.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for format_sql-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0b649eab134b4a2806c15eac752f5fe2f2042bd36a1d1ccbef7ff29286d0971 |
|
MD5 | bc150842b0bd9f63c02422f0ade1b3d2 |
|
BLAKE2b-256 | 46d7a1bd0188790e034433c58c1dbeca8c15fbc6526a7c1ea3aaf788e89f15eb |