1
0
Fork 0

Merging upstream version 17.2.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 20:43:05 +01:00
parent 06c5965633
commit ff2afd7448
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
91 changed files with 42856 additions and 42624 deletions

View file

@ -94,7 +94,11 @@ def parse_one(sql: str, **opts) -> Expression:
def parse_one(
sql: str, read: DialectType = None, into: t.Optional[exp.IntoType] = None, **opts
sql: str,
read: DialectType = None,
dialect: DialectType = None,
into: t.Optional[exp.IntoType] = None,
**opts,
) -> Expression:
"""
Parses the given SQL string and returns a syntax tree for the first parsed SQL statement.
@ -102,6 +106,7 @@ def parse_one(
Args:
sql: the SQL code string to parse.
read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").
dialect: the SQL dialect (alias for read)
into: the SQLGlot Expression to parse into.
**opts: other `sqlglot.parser.Parser` options.
@ -109,7 +114,7 @@ def parse_one(
The syntax tree for the first parsed statement.
"""
dialect = Dialect.get_or_raise(read)()
dialect = Dialect.get_or_raise(read or dialect)()
if into:
result = dialect.parse_into(into, sql, **opts)