From 8fe30fd23dc37ec3516e530a86d1c4b604e71241 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 10 Dec 2023 11:46:01 +0100 Subject: Merging upstream version 20.1.0. Signed-off-by: Daniel Baumann --- docs/sqlglot.html | 173 +++++++++++++++++++++++++++--------------------------- 1 file changed, 87 insertions(+), 86 deletions(-) (limited to 'docs/sqlglot.html') diff --git a/docs/sqlglot.html b/docs/sqlglot.html index 964cb97..8e43f21 100644 --- a/docs/sqlglot.html +++ b/docs/sqlglot.html @@ -697,68 +697,68 @@ make check # Full test suite & linter checks 22 Expression as Expression, 23 alias_ as alias, 24 and_ as and_, - 25 cast as cast, - 26 column as column, - 27 condition as condition, - 28 except_ as except_, - 29 from_ as from_, - 30 func as func, - 31 intersect as intersect, - 32 maybe_parse as maybe_parse, - 33 not_ as not_, - 34 or_ as or_, - 35 select as select, - 36 subquery as subquery, - 37 table_ as table, - 38 to_column as to_column, - 39 to_identifier as to_identifier, - 40 to_table as to_table, - 41 union as union, - 42) - 43from sqlglot.generator import Generator as Generator - 44from sqlglot.parser import Parser as Parser - 45from sqlglot.schema import MappingSchema as MappingSchema, Schema as Schema - 46from sqlglot.tokens import Tokenizer as Tokenizer, TokenType as TokenType - 47 - 48if t.TYPE_CHECKING: - 49 from sqlglot._typing import E - 50 from sqlglot.dialects.dialect import DialectType as DialectType - 51 - 52logger = logging.getLogger("sqlglot") - 53 + 25 case as case, + 26 cast as cast, + 27 column as column, + 28 condition as condition, + 29 except_ as except_, + 30 from_ as from_, + 31 func as func, + 32 intersect as intersect, + 33 maybe_parse as maybe_parse, + 34 not_ as not_, + 35 or_ as or_, + 36 select as select, + 37 subquery as subquery, + 38 table_ as table, + 39 to_column as to_column, + 40 to_identifier as to_identifier, + 41 to_table as to_table, + 42 union as union, + 43) + 44from sqlglot.generator import Generator as Generator + 45from sqlglot.parser import Parser as Parser + 46from sqlglot.schema import MappingSchema as MappingSchema, Schema as Schema + 47from sqlglot.tokens import Tokenizer as Tokenizer, TokenType as TokenType + 48 + 49if t.TYPE_CHECKING: + 50 from sqlglot._typing import E + 51 from sqlglot.dialects.dialect import DialectType as DialectType + 52 + 53logger = logging.getLogger("sqlglot") 54 - 55try: - 56 from sqlglot._version import __version__, __version_tuple__ - 57except ImportError: - 58 logger.error( - 59 "Unable to set __version__, run `pip install -e .` or `python setup.py develop` first." - 60 ) - 61 + 55 + 56try: + 57 from sqlglot._version import __version__, __version_tuple__ + 58except ImportError: + 59 logger.error( + 60 "Unable to set __version__, run `pip install -e .` or `python setup.py develop` first." + 61 ) 62 - 63pretty = False - 64"""Whether to format generated SQL by default.""" - 65 - 66schema = MappingSchema() - 67"""The default schema used by SQLGlot (e.g. in the optimizer).""" - 68 + 63 + 64pretty = False + 65"""Whether to format generated SQL by default.""" + 66 + 67schema = MappingSchema() + 68"""The default schema used by SQLGlot (e.g. in the optimizer).""" 69 - 70def parse( - 71 sql: str, read: DialectType = None, dialect: DialectType = None, **opts - 72) -> t.List[t.Optional[Expression]]: - 73 """ - 74 Parses the given SQL string into a collection of syntax trees, one per parsed SQL statement. - 75 - 76 Args: - 77 sql: the SQL code string to parse. - 78 read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql"). - 79 dialect: the SQL dialect (alias for read). - 80 **opts: other `sqlglot.parser.Parser` options. - 81 - 82 Returns: - 83 The resulting syntax tree collection. - 84 """ - 85 dialect = Dialect.get_or_raise(read or dialect)() - 86 return dialect.parse(sql, **opts) + 70 + 71def parse( + 72 sql: str, read: DialectType = None, dialect: DialectType = None, **opts + 73) -> t.List[t.Optional[Expression]]: + 74 """ + 75 Parses the given SQL string into a collection of syntax trees, one per parsed SQL statement. + 76 + 77 Args: + 78 sql: the SQL code string to parse. + 79 read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql"). + 80 dialect: the SQL dialect (alias for read). + 81 **opts: other `sqlglot.parser.Parser` options. + 82 + 83 Returns: + 84 The resulting syntax tree collection. + 85 """ + 86 return Dialect.get_or_raise(read or dialect).parse(sql, **opts) 87 88 89@t.overload @@ -792,7 +792,7 @@ make check # Full test suite & linter checks 117 The syntax tree for the first parsed statement. 118 """ 119 -120 dialect = Dialect.get_or_raise(read or dialect)() +120 dialect = Dialect.get_or_raise(read or dialect) 121 122 if into: 123 result = dialect.parse_into(into, sql, **opts) @@ -832,10 +832,11 @@ make check # Full test suite & linter checks 157 The list of transpiled SQL statements. 158 """ 159 write = (read if write is None else write) if identity else write -160 return [ -161 Dialect.get_or_raise(write)().generate(expression, copy=False, **opts) if expression else "" -162 for expression in parse(sql, read, error_level=error_level) -163 ] +160 write = Dialect.get_or_raise(write) +161 return [ +162 write.generate(expression, copy=False, **opts) if expression else "" +163 for expression in parse(sql, read, error_level=error_level) +164 ] @@ -891,23 +892,22 @@ make check # Full test suite & linter checks -
71def parse(
-72    sql: str, read: DialectType = None, dialect: DialectType = None, **opts
-73) -> t.List[t.Optional[Expression]]:
-74    """
-75    Parses the given SQL string into a collection of syntax trees, one per parsed SQL statement.
-76
-77    Args:
-78        sql: the SQL code string to parse.
-79        read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").
-80        dialect: the SQL dialect (alias for read).
-81        **opts: other `sqlglot.parser.Parser` options.
-82
-83    Returns:
-84        The resulting syntax tree collection.
-85    """
-86    dialect = Dialect.get_or_raise(read or dialect)()
-87    return dialect.parse(sql, **opts)
+            
72def parse(
+73    sql: str, read: DialectType = None, dialect: DialectType = None, **opts
+74) -> t.List[t.Optional[Expression]]:
+75    """
+76    Parses the given SQL string into a collection of syntax trees, one per parsed SQL statement.
+77
+78    Args:
+79        sql: the SQL code string to parse.
+80        read: the SQL dialect to apply during parsing (eg. "spark", "hive", "presto", "mysql").
+81        dialect: the SQL dialect (alias for read).
+82        **opts: other `sqlglot.parser.Parser` options.
+83
+84    Returns:
+85        The resulting syntax tree collection.
+86    """
+87    return Dialect.get_or_raise(read or dialect).parse(sql, **opts)
 
@@ -963,7 +963,7 @@ make check # Full test suite & linter checks
118 The syntax tree for the first parsed statement. 119 """ 120 -121 dialect = Dialect.get_or_raise(read or dialect)() +121 dialect = Dialect.get_or_raise(read or dialect) 122 123 if into: 124 result = dialect.parse_into(into, sql, **opts) @@ -1036,10 +1036,11 @@ make check # Full test suite & linter checks 158 The list of transpiled SQL statements. 159 """ 160 write = (read if write is None else write) if identity else write -161 return [ -162 Dialect.get_or_raise(write)().generate(expression, copy=False, **opts) if expression else "" -163 for expression in parse(sql, read, error_level=error_level) -164 ] +161 write = Dialect.get_or_raise(write) +162 return [ +163 write.generate(expression, copy=False, **opts) if expression else "" +164 for expression in parse(sql, read, error_level=error_level) +165 ]
-- cgit v1.2.3