tconbeer/sqlfmt

One specific BQ-DBT SQL file gets wrongly formatted and becomes unusable

tgmof opened this issue · 0 comments

tgmof commented

Describe the bug
I am considering using your amazing library and found out that when I format it with sqlfmt, it makes it unusable because it accidentally comments out code that was in used.
The file contains many field names and data that I cannot share publicly but I'm more than happy to send it to you by email. Simply delete it when you don't need it anymore. At which email can I send it to you?
This is not a critical bug since playing around with the file before running sqlfmt solves the issue.

To Reproduce
I cannot reproduce with sqlfmt directly but only with VSCode so I created an issue in the repo of the people responsible for the extension I'm using to know what parameter they use. AltimateAI/vscode-dbt-power-user#856

Expected behavior
The SQL Code / dbt-jinja Code should be valid.

Actual behavior
Some code gets commented out making the dbt-jinja Code & SQL Code invalid.
Notice that the comment mentioned in the "To Reproduce" step now extended from line 74 to line 104 and thus breaking the code.

Additional context
What is the output of sqlfmt --version?
0.21.2

What is the output of pip list (or pipx list if you installed using pipx)?
Package Version


agate 1.6.3
aiodns 3.1.1
aiohttp 3.9.1
aiosignal 1.3.1
anybadge 1.14.0
anyio 4.1.0
argcomplete 3.1.6
async-timeout 4.0.3
attrs 23.1.0
Babel 2.13.1
black 23.11.0
Brotli 1.1.0
cachetools 5.3.2
certifi 2023.11.17
cffi 1.16.0
chardet 5.2.0
charset-normalizer 3.3.2
click 8.1.7
colorama 0.4.6
colorlog 4.8.0
dbt-bigquery 1.5.2
dbt-core 1.5.1
dbt-extractor 0.4.1
distlib 0.3.7
exceptiongroup 1.2.0
fastjsonschema 2.19.0
filelock 3.13.1
frozenlist 1.4.0
future 0.18.3
gitdb 4.0.11
GitPython 3.1.40
google-api-core 2.15.0
google-auth 2.25.1
google-cloud-bigquery 3.13.0
google-cloud-core 2.4.1
google-cloud-dataproc 5.8.0
google-cloud-storage 2.13.0
google-crc32c 1.5.0
google-resumable-media 2.6.0
googleapis-common-protos 1.62.0
grpc-google-iam-v1 0.13.0
grpcio 1.60.0
grpcio-status 1.60.0
h11 0.14.0
hologram 0.0.16
httpcore 1.0.2
httpx 0.25.2
idna 3.6
importlib-resources 6.1.1
iniconfig 2.0.0
isodate 0.6.1
Jinja2 3.1.2
jsonschema 4.20.0
jsonschema-specifications 2023.11.2
jupyter_core 5.5.0
leather 0.3.4
Logbook 1.5.3
mando 0.6.4
MarkupSafe 2.1.3
mashumaro 3.6
mdp 0.9.3
minimal-snowplow-tracker 0.0.2
msgpack 1.0.7
multidict 6.0.4
mypy-extensions 1.0.0
nbformat 5.9.2
networkx 2.8.8
oyaml 1.0
packaging 23.2
parsedatetime 2.4
pathspec 0.11.2
pip 23.2.1
pkgutil_resolve_name 1.3.10
platformdirs 4.1.0
plotly 5.18.0
pluggy 1.3.0
progress 1.6
proto-plus 1.23.0
protobuf 4.25.1
pyasn1 0.5.1
pyasn1-modules 0.3.0
pycares 4.4.0
pycparser 2.21
pyproject-api 1.6.1
pytest 7.4.3
python-dateutil 2.8.2
python-slugify 8.0.1
pytimeparse 1.1.8
pytz 2023.3.post1
PyYAML 6.0.1
radon 5.1.0
referencing 0.32.0
requests 2.31.0
rpds-py 0.13.2
rsa 4.9
ruamel.yaml 0.17.40
ruamel.yaml.clib 0.2.8
setuptools 69.0.2
shandy-sqlfmt 0.21.2
simplejson 3.19.2
six 1.16.0
smmap 5.0.1
sniffio 1.3.0
sqlglot 10.6.4
sqlparse 0.4.3
tabulate 0.9.0
tenacity 8.2.3
text-unidecode 1.3
toml 0.10.2
tomli 2.0.1
tomlkit 0.12.3
tox 4.11.4
tqdm 4.66.1
traitlets 5.14.0
typing_extensions 4.8.0
urllib3 2.1.0
virtualenv 20.25.0
Werkzeug 2.3.8
wheel 0.41.0
wily 1.25.0
xmltodict 0.13.0
yarl 1.9.3
yq 3.2.3
zipp 3.17.0