bxparks/bigquery-schema-generator

Make quoted integer detection optional

de-code opened this issue · 5 comments

#15 introduced automatic conversion of quoted numeric version to INTEGER type.
For my use-case I would not want that behaviour. Some identifiers using numbers but should be treated as strings. e.g. they may not just consist of digits in other files. I am generating the JSON and would generate the JSON with the corresponding type (i.e. if I wanted something to be represented as an INTEGER then I wouldn't quote it).

Hi, Thanks for this pull request. I agree that a flag to turn off this inference logic inside quoted strings is useful. In addition to integers, I think it would be useful for floats and booleans as well. So I took your PR, and created a commit on top of it to generalize the flag into --quoted_values_are_strings. I also added more tests, updated the README.md, updated the the CHANGELOG.md.

I uploaded my changes to the quoted branch. You should be able to merge that into your branch, then update the PR. If you do that, I will approve and merge the combined changes. Sound good?

I agree it equally makes sense for floats and booleans. I couldn't think of a good name right away. Your version would work well for me. (I merged it into my branch)

Quoted dates and timestamps are still processed. Maybe we could mention that in the description of the flag.

That's true, quoted dates, times and timestamps are still processed. I think that makes sense because there's no other way to represent those values except as quoted strings. I will update the README.md to make this more clear after I merge in your PR.

All merged and updated. I think this can be closed.

That's great, thank you!