Merging upstream version 10.5.2.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
77197f1e44
commit
e0f3bbb5f3
58 changed files with 1480 additions and 383 deletions
|
@ -32,7 +32,7 @@ from sqlglot.parser import Parser
|
|||
from sqlglot.schema import MappingSchema
|
||||
from sqlglot.tokens import Tokenizer, TokenType
|
||||
|
||||
__version__ = "10.4.2"
|
||||
__version__ = "10.5.2"
|
||||
|
||||
pretty = False
|
||||
|
||||
|
@ -60,9 +60,9 @@ def parse(
|
|||
def parse_one(
|
||||
sql: str,
|
||||
read: t.Optional[str | Dialect] = None,
|
||||
into: t.Optional[Expression | str] = None,
|
||||
into: t.Optional[t.Type[Expression] | str] = None,
|
||||
**opts,
|
||||
) -> t.Optional[Expression]:
|
||||
) -> Expression:
|
||||
"""
|
||||
Parses the given SQL string and returns a syntax tree for the first parsed SQL statement.
|
||||
|
||||
|
@ -83,7 +83,12 @@ def parse_one(
|
|||
else:
|
||||
result = dialect.parse(sql, **opts)
|
||||
|
||||
return result[0] if result else None
|
||||
for expression in result:
|
||||
if not expression:
|
||||
raise ParseError(f"No expression was parsed from '{sql}'")
|
||||
return expression
|
||||
else:
|
||||
raise ParseError(f"No expression was parsed from '{sql}'")
|
||||
|
||||
|
||||
def transpile(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue