diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-06 07:48:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-08-06 07:48:11 +0000 |
commit | 379c6d1f52e1d311867c4f789dc389da1d9af898 (patch) | |
tree | c9ca62eb7b8b7e861cc67248850db220ad0881c9 /sqlglot/__init__.py | |
parent | Releasing debian version 17.7.0-1. (diff) | |
download | sqlglot-379c6d1f52e1d311867c4f789dc389da1d9af898.tar.xz sqlglot-379c6d1f52e1d311867c4f789dc389da1d9af898.zip |
Merging upstream version 17.9.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/__init__.py')
-rw-r--r-- | sqlglot/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sqlglot/__init__.py b/sqlglot/__init__.py index 42801ac..be10f3d 100644 --- a/sqlglot/__init__.py +++ b/sqlglot/__init__.py @@ -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) |