sqlglot.parse_one - use read keyword argument #1996
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of PR
Is your Pull Request linked to an existing Issue or Pull Request?
Fixes #1995.
For older versions (before
17.1.0
) ofsqlglot
,SqlglotColumnTreeBuilder.from_raw_column_name_or_column_reference
would break.
Give a brief description for the solution you have provided
in 17.1.0 the
dialect
keyword argument was introduced as a synonym forread
. But this breaks on earlier versions ofsqlglot
, so this changes to use theread
parameter, which is compatible with 'all' (that we support) versions ofsqlglot
.As a side-point, I wonder if it makes sense for us to wrap
parse_one
, as we use it in several places in the codebase? That way if in the future the api changes and we need to provide compatibility code, we only need it in one place. We also avoid these kinds of issues, as we wouldn't need to add further calls (directly) toparse_one
, where it would be easy to accidentally usedialect=
if the developer has a newersqlglot
installed (and as used in CI).PR Checklist