diff options
Diffstat (limited to 'sqlglot/__init__.py')
-rw-r--r-- | sqlglot/__init__.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/sqlglot/__init__.py b/sqlglot/__init__.py index 739ec29..42801ac 100644 --- a/sqlglot/__init__.py +++ b/sqlglot/__init__.py @@ -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) |