Merging upstream version 17.9.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
2bf6699c56
commit
9777880e00
87 changed files with 45907 additions and 42511 deletions
|
@ -67,19 +67,22 @@ schema = MappingSchema()
|
|||
"""The default schema used by SQLGlot (e.g. in the optimizer)."""
|
||||
|
||||
|
||||
def parse(sql: str, read: DialectType = None, **opts) -> t.List[t.Optional[Expression]]:
|
||||
def parse(
|
||||
sql: str, read: DialectType = None, dialect: DialectType = None, **opts
|
||||
) -> t.List[t.Optional[Expression]]:
|
||||
"""
|
||||
Parses the given SQL string into a collection of syntax trees, one per parsed SQL statement.
|
||||
|
||||
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).
|
||||
**opts: other `sqlglot.parser.Parser` options.
|
||||
|
||||
Returns:
|
||||
The resulting syntax tree collection.
|
||||
"""
|
||||
dialect = Dialect.get_or_raise(read)()
|
||||
dialect = Dialect.get_or_raise(read or dialect)()
|
||||
return dialect.parse(sql, **opts)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue