sqlfmt is an opinionated CLI tool that formats your sql files
Project description
sqlfmt
sqlfmt is an opinionated CLI tool that formats your dbt sql files. It is similar in nature to black, gofmt, and rustfmt.
sqlfmt is not configurable, except for line length. It enforces a single style. sqlfmt maintains comments and some extra newlines, but largely ignores all indentation and line breaks in the input file.
sqlfmt is not a linter. It does not parse your code; it just tokenizes it and tracks a small subset of tokens that impact formatting. This lets us "do one thing and do it well:" sqlfmt is very fast, and easier to extend than linters that need a full sql grammar.
sqlfmt is designed to work with sql files that contain jinja tags and blocks. It formats the code that users look at, and therefore doesn't need to know anything about what happens after the templates are rendered.
Contributing
Setting up Your Dev Environment and Running Tests
- Install Poetry if you don't have it already. You may also need or want pyenv, make, and gcc. A complete setup from a fresh install of Ubuntu can be found here
- Clone this repo into a directory (let's call it
sqlfmt), thencd sqlfmt - Use
poetry installto install the project (editable) and its dependencies into a new virtual env - Use
poetry shellto spawn a subshell - Type
maketo run all tests and linters, or runpytest,black,flake8,isort, andmypyindividually.
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
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 shandy-sqlfmt-0.1.0a8.tar.gz.
File metadata
- Download URL: shandy-sqlfmt-0.1.0a8.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Linux/5.11.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25771a5d13559d65a8c5d2f865fe1ede42ec9fa495568247550b36ce9ab1a2d2
|
|
| MD5 |
98c92228f94757768e7882684a63cc72
|
|
| BLAKE2b-256 |
25f0bac57b799af4b9d3e41c2d8997e0f1cd6bffbe285fe7b981bd68d359cca1
|
File details
Details for the file shandy_sqlfmt-0.1.0a8-py3-none-any.whl.
File metadata
- Download URL: shandy_sqlfmt-0.1.0a8-py3-none-any.whl
- Upload date:
- Size: 25.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.7 Linux/5.11.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f3fc44f21cc219a1f09f266820b01afe962841327d44efb48963e25564653f8
|
|
| MD5 |
2d96808e2fdc90de5976666d5fac4d9b
|
|
| BLAKE2b-256 |
b8dc1d41afc5c90f4a982dd4289e2cdbd9dc27b955e81e6be08aed9e11d485f4
|