-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect JSON wrapper break JQ #120
Comments
@andy65535 Hi! This is because in stdout output is not JSON, but python dict (and because of that you see None, in JSON it must be null). If you want JSON - remove flag --no-dump and it will dump json to the file. I didn't thought about use case that someone need json in stdout :) I will add in next release flag --json to get output in stdout as json, not Python object. |
@xnuinside thank you for replay!
parser leave back quotes and final JSON become:
|
@andy65535 hi, I'm ready to kill myself for the my previous answer to you! first of all ))) you can get json output with python code )) (I really need spend time on documentation improvement) - you can do it like this (sample added in README): https://github.com/xnuinside/simple-ddl-parser#get-output-in-json second - to get output without artifacts like ` at the end you can use flag "normalize_names=True" like here:
so if you will run parser like:
You will get required output. by default (without flag normalize_names=True) parser leave as is all symbols to get possible reconstruct DDL from parser output Again, one more time SORRY for my wrong answer ) With CLI is not possible to use normalize_names flag - I will work in next release to update the CLI to keep all arguments & settings for parser |
Describe the bug
Commonly used Linux command line JQ tool doesn't work with JSON which prepared by sdp, because jq expect that wrapper is double quote.
Example of real GCP BigQuery DDL:
DDL:
OUTPUT:
JQ run:
Followed JSON is OK:
Here is few issues:
JQ expect that all values wrapped (None, False, True - as well)
JQ expect that wrapper will be double quote, not single quote.
JSON validator https://jsonformatter.curiousconcept.com/ said that points 1 and 2 are RFC violation.
Incorrect parsing if table name wrapped by back quote: "CREATE TABLE `dataset.table`". As you can see from output, parser keeped back quote at the beginning (but sometimes at the ending) of the table name:
The text was updated successfully, but these errors were encountered: