sqlglotc 30.0.2__tar.gz → 30.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sqlglotc-30.0.2/sqlglotc.egg-info → sqlglotc-30.1.0}/PKG-INFO +1 -1
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/pyproject.toml +2 -6
- sqlglotc-30.1.0/setup.py +132 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/errors.py +3 -3
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/builders.py +18 -13
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/core.py +71 -68
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/ddl.py +4 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/dml.py +9 -9
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/functions.py +2 -2
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/properties.py +4 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/query.py +54 -33
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/string.py +1 -0
- sqlglotc-30.1.0/sqlglot/generator.py +5819 -0
- sqlglotc-30.1.0/sqlglot/generators/athena.py +180 -0
- sqlglotc-30.1.0/sqlglot/generators/bigquery.py +686 -0
- sqlglotc-30.1.0/sqlglot/generators/clickhouse.py +665 -0
- sqlglotc-30.1.0/sqlglot/generators/databricks.py +101 -0
- sqlglotc-30.1.0/sqlglot/generators/doris.py +612 -0
- sqlglotc-30.1.0/sqlglot/generators/dremio.py +100 -0
- sqlglotc-30.1.0/sqlglot/generators/drill.py +112 -0
- sqlglotc-30.1.0/sqlglot/generators/druid.py +31 -0
- sqlglotc-30.1.0/sqlglot/generators/duckdb.py +4179 -0
- sqlglotc-30.1.0/sqlglot/generators/dune.py +14 -0
- sqlglotc-30.1.0/sqlglot/generators/exasol.py +926 -0
- sqlglotc-30.1.0/sqlglot/generators/fabric.py +149 -0
- sqlglotc-30.1.0/sqlglot/generators/hive.py +544 -0
- sqlglotc-30.1.0/sqlglot/generators/materialize.py +56 -0
- sqlglotc-30.1.0/sqlglot/generators/mysql.py +795 -0
- sqlglotc-30.1.0/sqlglot/generators/oracle.py +165 -0
- sqlglotc-30.1.0/sqlglot/generators/postgres.py +567 -0
- sqlglotc-30.1.0/sqlglot/generators/presto.py +647 -0
- sqlglotc-30.1.0/sqlglot/generators/prql.py +7 -0
- sqlglotc-30.1.0/sqlglot/generators/redshift.py +347 -0
- sqlglotc-30.1.0/sqlglot/generators/risingwave.py +32 -0
- sqlglotc-30.1.0/sqlglot/generators/singlestore.py +1595 -0
- sqlglotc-30.1.0/sqlglot/generators/snowflake.py +1138 -0
- sqlglotc-30.1.0/sqlglot/generators/solr.py +7 -0
- sqlglotc-30.1.0/sqlglot/generators/spark.py +202 -0
- sqlglotc-30.1.0/sqlglot/generators/spark2.py +253 -0
- sqlglotc-30.1.0/sqlglot/generators/sqlite.py +320 -0
- sqlglotc-30.1.0/sqlglot/generators/starrocks.py +325 -0
- sqlglotc-30.1.0/sqlglot/generators/tableau.py +51 -0
- sqlglotc-30.1.0/sqlglot/generators/teradata.py +181 -0
- sqlglotc-30.1.0/sqlglot/generators/trino.py +68 -0
- sqlglotc-30.1.0/sqlglot/generators/tsql.py +624 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/helper.py +21 -18
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/optimizer/qualify_columns.py +7 -6
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/optimizer/resolver.py +11 -12
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/optimizer/scope.py +24 -21
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parser.py +97 -98
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/clickhouse.py +11 -8
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/dremio.py +2 -2
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/duckdb.py +5 -3
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/hive.py +1 -1
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/prql.py +2 -1
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/redshift.py +5 -3
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/snowflake.py +33 -17
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/tsql.py +2 -1
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/schema.py +9 -8
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/trie.py +3 -2
- {sqlglotc-30.0.2 → sqlglotc-30.1.0/sqlglotc.egg-info}/PKG-INFO +1 -1
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglotc.egg-info/SOURCES.txt +33 -5
- sqlglotc-30.1.0/sqlglotc.egg-info/top_level.txt +2 -0
- sqlglotc-30.0.2/setup.py +0 -107
- sqlglotc-30.0.2/sqlglot/__init__.py +0 -0
- sqlglotc-30.0.2/sqlglot/executor/__init__.py +0 -0
- sqlglotc-30.0.2/sqlglot/expressions/__init__.py +0 -0
- sqlglotc-30.0.2/sqlglot/optimizer/__init__.py +0 -0
- sqlglotc-30.0.2/sqlglot/parsers/__init__.py +0 -0
- sqlglotc-30.0.2/sqlglotc.egg-info/top_level.txt +0 -2
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/MANIFEST.in +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/setup.cfg +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/executor/table.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/aggregate.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/array.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/constraints.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/datatypes.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/json.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/math.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/expressions/temporal.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/optimizer/isolate_table_selects.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/optimizer/normalize_identifiers.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/optimizer/qualify.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/optimizer/qualify_tables.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/athena.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/base.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/bigquery.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/databricks.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/doris.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/drill.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/druid.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/dune.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/exasol.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/fabric.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/materialize.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/mysql.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/oracle.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/postgres.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/presto.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/risingwave.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/singlestore.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/solr.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/spark.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/spark2.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/sqlite.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/starrocks.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/tableau.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/teradata.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/parsers/trino.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/serde.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/time.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglot/tokenizer_core.py +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglotc.egg-info/dependency_links.txt +0 -0
- {sqlglotc-30.0.2 → sqlglotc-30.1.0}/sqlglotc.egg-info/requires.txt +0 -0
|
@@ -14,7 +14,7 @@ Homepage = "https://sqlglot.com/"
|
|
|
14
14
|
Repository = "https://github.com/tobymao/sqlglot"
|
|
15
15
|
|
|
16
16
|
[build-system]
|
|
17
|
-
requires = ["setuptools >= 61.0", "setuptools_scm", "sqlglot-mypy>=1.19.1.post1", "types-python-dateutil"]
|
|
17
|
+
requires = ["setuptools >= 61.0", "setuptools_scm", "sqlglot-mypy>=1.19.1.post1", "types-python-dateutil", "sqlglot"]
|
|
18
18
|
build-backend = "setuptools.build_meta"
|
|
19
19
|
|
|
20
20
|
[tool.setuptools]
|
|
@@ -25,10 +25,6 @@ root = ".."
|
|
|
25
25
|
fallback_version = "0.0.0"
|
|
26
26
|
local_scheme = "no-local-version"
|
|
27
27
|
|
|
28
|
-
[tool.mypy]
|
|
29
|
-
# Allow mypyc to resolve sqlglot.* from the repo root (../sqlglot/) or sdist root (./sqlglot/).
|
|
30
|
-
mypy_path = [".", ".."]
|
|
31
|
-
|
|
32
28
|
[[tool.mypy.overrides]]
|
|
33
|
-
module = "sqlglot._version"
|
|
29
|
+
module = ["sqlglot._version", "sqlglotc"]
|
|
34
30
|
ignore_missing_imports = true
|
sqlglotc-30.1.0/setup.py
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
|
|
4
|
+
from setuptools import setup
|
|
5
|
+
from setuptools.command.build_ext import build_ext as _build_ext
|
|
6
|
+
from setuptools.command.sdist import sdist as _sdist
|
|
7
|
+
from mypyc.build import mypycify
|
|
8
|
+
|
|
9
|
+
SQLGLOT_SRC = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "sqlglot")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _find_sqlglot_dir():
|
|
13
|
+
"""Find the sqlglot source directory: repo source, or installed package.
|
|
14
|
+
|
|
15
|
+
When the installed package is in site-packages, copy it to a clean temp
|
|
16
|
+
directory so mypy doesn't discover unrelated modules (mypy_extensions,
|
|
17
|
+
typing_extensions) that cause shadowing errors.
|
|
18
|
+
"""
|
|
19
|
+
if os.path.isdir(SQLGLOT_SRC):
|
|
20
|
+
return SQLGLOT_SRC
|
|
21
|
+
|
|
22
|
+
# Fall back to the installed sqlglot package (build dependency).
|
|
23
|
+
import sqlglot
|
|
24
|
+
import tempfile
|
|
25
|
+
|
|
26
|
+
installed = os.path.dirname(sqlglot.__file__)
|
|
27
|
+
tmp = tempfile.mkdtemp(prefix="sqlglotc_build_")
|
|
28
|
+
dst = os.path.join(tmp, "sqlglot")
|
|
29
|
+
shutil.copytree(installed, dst)
|
|
30
|
+
return dst
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _subpkg_files(src_dir, subpkg, files=None):
|
|
34
|
+
"""List source files from a sqlglot subpackage. Compiles all .py files if `files` is None."""
|
|
35
|
+
if files is None:
|
|
36
|
+
files = sorted(
|
|
37
|
+
f
|
|
38
|
+
for f in os.listdir(os.path.join(src_dir, subpkg))
|
|
39
|
+
if f.endswith(".py") and f != "__init__.py"
|
|
40
|
+
)
|
|
41
|
+
return [os.path.join(subpkg, f) for f in files]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _source_files(src_dir):
|
|
45
|
+
return [
|
|
46
|
+
"errors.py",
|
|
47
|
+
"generator.py",
|
|
48
|
+
"helper.py",
|
|
49
|
+
"parser.py",
|
|
50
|
+
"schema.py",
|
|
51
|
+
"serde.py",
|
|
52
|
+
"time.py",
|
|
53
|
+
"tokenizer_core.py",
|
|
54
|
+
"trie.py",
|
|
55
|
+
*_subpkg_files(src_dir, "expressions"),
|
|
56
|
+
*_subpkg_files(src_dir, "generators"),
|
|
57
|
+
*_subpkg_files(
|
|
58
|
+
src_dir,
|
|
59
|
+
"optimizer",
|
|
60
|
+
[
|
|
61
|
+
"scope.py",
|
|
62
|
+
"resolver.py",
|
|
63
|
+
"isolate_table_selects.py",
|
|
64
|
+
"normalize_identifiers.py",
|
|
65
|
+
"qualify.py",
|
|
66
|
+
"qualify_tables.py",
|
|
67
|
+
"qualify_columns.py",
|
|
68
|
+
],
|
|
69
|
+
),
|
|
70
|
+
*_subpkg_files(src_dir, "parsers"),
|
|
71
|
+
*_subpkg_files(src_dir, "executor", ["table.py"]),
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
SRC_DIR = _find_sqlglot_dir()
|
|
76
|
+
SOURCE_FILES = _source_files(SRC_DIR)
|
|
77
|
+
|
|
78
|
+
# Set MYPYPATH to the parent of the sqlglot source so mypy resolves
|
|
79
|
+
# `import sqlglot` from there — not from site-packages where
|
|
80
|
+
# mypy_extensions.py / typing_extensions.py can cause shadowing errors.
|
|
81
|
+
os.environ["MYPYPATH"] = os.path.dirname(SRC_DIR)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _source_paths():
|
|
85
|
+
return [os.path.join(SRC_DIR, f) for f in SOURCE_FILES]
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class build_ext(_build_ext):
|
|
89
|
+
def copy_extensions_to_source(self):
|
|
90
|
+
"""For editable installs, put sqlglot.* .so files in the sqlglot source dir."""
|
|
91
|
+
for ext in self.extensions:
|
|
92
|
+
fullname = self.get_ext_fullname(ext.name)
|
|
93
|
+
filename = self.get_ext_filename(fullname)
|
|
94
|
+
src = os.path.join(self.build_lib, filename)
|
|
95
|
+
parts = fullname.split(".")
|
|
96
|
+
if parts[0] == "sqlglot" and os.path.isdir(SQLGLOT_SRC):
|
|
97
|
+
# Place compiled sqlglot.* / sqlglot.sub.* modules in the sqlglot source tree.
|
|
98
|
+
sub_module = ".".join(parts[1:])
|
|
99
|
+
dst = os.path.join(SQLGLOT_SRC, self.get_ext_filename(sub_module))
|
|
100
|
+
else:
|
|
101
|
+
# Place the mypyc runtime helper (e.g., HASH__mypyc) inside sqlglot/.
|
|
102
|
+
# sqlglot/__init__.py bootstraps it into sys.modules for editable installs.
|
|
103
|
+
dst = os.path.join(SQLGLOT_SRC, os.path.basename(filename))
|
|
104
|
+
self.copy_file(src, dst, level=self.verbose)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class sdist(_sdist):
|
|
108
|
+
"""Bundle sqlglot source files into the sdist as a fallback."""
|
|
109
|
+
|
|
110
|
+
def run(self):
|
|
111
|
+
local_sqlglot = os.path.join(os.path.dirname(os.path.abspath(__file__)), "sqlglot")
|
|
112
|
+
os.makedirs(local_sqlglot, exist_ok=True)
|
|
113
|
+
subpkgs = {os.path.dirname(f) for f in SOURCE_FILES if os.path.dirname(f)}
|
|
114
|
+
for subpkg in subpkgs:
|
|
115
|
+
pkg_dir = os.path.join(local_sqlglot, subpkg)
|
|
116
|
+
os.makedirs(pkg_dir, exist_ok=True)
|
|
117
|
+
for fname in SOURCE_FILES:
|
|
118
|
+
dst_path = os.path.join(local_sqlglot, fname)
|
|
119
|
+
os.makedirs(os.path.dirname(dst_path), exist_ok=True)
|
|
120
|
+
shutil.copy2(os.path.join(SQLGLOT_SRC, fname), dst_path)
|
|
121
|
+
try:
|
|
122
|
+
super().run()
|
|
123
|
+
finally:
|
|
124
|
+
shutil.rmtree(local_sqlglot, ignore_errors=True)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
setup(
|
|
128
|
+
name="sqlglotc",
|
|
129
|
+
packages=[],
|
|
130
|
+
ext_modules=mypycify(_source_paths(), opt_level=os.environ.get("MYPYC_OPT", "2")),
|
|
131
|
+
cmdclass={"build_ext": build_ext, "sdist": sdist},
|
|
132
|
+
)
|
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import typing as t
|
|
4
4
|
from enum import auto
|
|
5
|
-
|
|
5
|
+
from collections.abc import Sequence
|
|
6
6
|
from sqlglot.helper import AutoName
|
|
7
7
|
|
|
8
8
|
|
|
@@ -150,7 +150,7 @@ def highlight_sql(
|
|
|
150
150
|
return formatted_sql, start_context, highlight, end_context
|
|
151
151
|
|
|
152
152
|
|
|
153
|
-
def concat_messages(errors:
|
|
153
|
+
def concat_messages(errors: Sequence[t.Any], maximum: int) -> str:
|
|
154
154
|
msg = [str(e) for e in errors[:maximum]]
|
|
155
155
|
remaining = len(errors) - maximum
|
|
156
156
|
if remaining > 0:
|
|
@@ -158,5 +158,5 @@ def concat_messages(errors: t.Sequence[t.Any], maximum: int) -> str:
|
|
|
158
158
|
return "\n\n".join(msg)
|
|
159
159
|
|
|
160
160
|
|
|
161
|
-
def merge_errors(errors:
|
|
161
|
+
def merge_errors(errors: Sequence[ParseError]) -> list[dict[str, t.Any]]:
|
|
162
162
|
return [e_dict for error in errors for e_dict in error.errors]
|
|
@@ -50,13 +50,14 @@ from sqlglot.expressions.functions import Case, Cast
|
|
|
50
50
|
from sqlglot.expressions.array import Array
|
|
51
51
|
|
|
52
52
|
if t.TYPE_CHECKING:
|
|
53
|
+
from collections.abc import Sequence, Iterable
|
|
53
54
|
from sqlglot.dialects.dialect import DialectType
|
|
54
55
|
from sqlglot.expressions.core import ExpOrStr, Func
|
|
55
56
|
from sqlglot.expressions.datatypes import DATA_TYPE
|
|
56
57
|
from sqlglot.expressions.query import Query
|
|
57
58
|
|
|
58
59
|
|
|
59
|
-
def select(*expressions: ExpOrStr, dialect: DialectType = None, **opts) -> Select:
|
|
60
|
+
def select(*expressions: ExpOrStr, dialect: DialectType = None, **opts: t.Any) -> Select:
|
|
60
61
|
"""
|
|
61
62
|
Initializes a syntax tree from one or multiple SELECT expressions.
|
|
62
63
|
|
|
@@ -78,7 +79,7 @@ def select(*expressions: ExpOrStr, dialect: DialectType = None, **opts) -> Selec
|
|
|
78
79
|
return Select().select(*expressions, dialect=dialect, **opts)
|
|
79
80
|
|
|
80
81
|
|
|
81
|
-
def from_(expression: ExpOrStr, dialect: DialectType = None, **opts) -> Select:
|
|
82
|
+
def from_(expression: ExpOrStr, dialect: DialectType = None, **opts: t.Any) -> Select:
|
|
82
83
|
"""
|
|
83
84
|
Initializes a syntax tree from a FROM expression.
|
|
84
85
|
|
|
@@ -105,9 +106,9 @@ def update(
|
|
|
105
106
|
properties: t.Optional[dict] = None,
|
|
106
107
|
where: t.Optional[ExpOrStr] = None,
|
|
107
108
|
from_: t.Optional[ExpOrStr] = None,
|
|
108
|
-
with_: t.Optional[
|
|
109
|
+
with_: t.Optional[dict[str, ExpOrStr]] = None,
|
|
109
110
|
dialect: DialectType = None,
|
|
110
|
-
**opts,
|
|
111
|
+
**opts: t.Any,
|
|
111
112
|
) -> Update:
|
|
112
113
|
"""
|
|
113
114
|
Creates an update statement.
|
|
@@ -166,7 +167,7 @@ def delete(
|
|
|
166
167
|
where: t.Optional[ExpOrStr] = None,
|
|
167
168
|
returning: t.Optional[ExpOrStr] = None,
|
|
168
169
|
dialect: DialectType = None,
|
|
169
|
-
**opts,
|
|
170
|
+
**opts: t.Any,
|
|
170
171
|
) -> Delete:
|
|
171
172
|
"""
|
|
172
173
|
Builds a delete statement.
|
|
@@ -195,12 +196,12 @@ def delete(
|
|
|
195
196
|
def insert(
|
|
196
197
|
expression: ExpOrStr,
|
|
197
198
|
into: ExpOrStr,
|
|
198
|
-
columns: t.Optional[
|
|
199
|
+
columns: t.Optional[Sequence[str | Identifier]] = None,
|
|
199
200
|
overwrite: t.Optional[bool] = None,
|
|
200
201
|
returning: t.Optional[ExpOrStr] = None,
|
|
201
202
|
dialect: DialectType = None,
|
|
202
203
|
copy: bool = True,
|
|
203
|
-
**opts,
|
|
204
|
+
**opts: t.Any,
|
|
204
205
|
) -> Insert:
|
|
205
206
|
"""
|
|
206
207
|
Builds an INSERT statement.
|
|
@@ -244,7 +245,7 @@ def merge(
|
|
|
244
245
|
returning: t.Optional[ExpOrStr] = None,
|
|
245
246
|
dialect: DialectType = None,
|
|
246
247
|
copy: bool = True,
|
|
247
|
-
**opts,
|
|
248
|
+
**opts: t.Any,
|
|
248
249
|
) -> Merge:
|
|
249
250
|
"""
|
|
250
251
|
Builds a MERGE statement.
|
|
@@ -408,7 +409,7 @@ def subquery(
|
|
|
408
409
|
expression: ExpOrStr,
|
|
409
410
|
alias: t.Optional[Identifier | str] = None,
|
|
410
411
|
dialect: DialectType = None,
|
|
411
|
-
**opts,
|
|
412
|
+
**opts: t.Any,
|
|
412
413
|
) -> Select:
|
|
413
414
|
"""
|
|
414
415
|
Build a subquery expression that's selected from.
|
|
@@ -433,7 +434,11 @@ def subquery(
|
|
|
433
434
|
|
|
434
435
|
|
|
435
436
|
def cast(
|
|
436
|
-
expression: ExpOrStr,
|
|
437
|
+
expression: ExpOrStr,
|
|
438
|
+
to: DATA_TYPE,
|
|
439
|
+
copy: bool = True,
|
|
440
|
+
dialect: DialectType = None,
|
|
441
|
+
**opts: t.Any,
|
|
437
442
|
) -> Cast:
|
|
438
443
|
"""Cast an expression to a data type.
|
|
439
444
|
|
|
@@ -512,9 +517,9 @@ def table_(
|
|
|
512
517
|
|
|
513
518
|
|
|
514
519
|
def values(
|
|
515
|
-
values:
|
|
520
|
+
values: Iterable[tuple[object, ...] | Tuple],
|
|
516
521
|
alias: t.Optional[str] = None,
|
|
517
|
-
columns: t.Optional[
|
|
522
|
+
columns: t.Optional[Iterable[str] | dict[str, DataType]] = None,
|
|
518
523
|
) -> Values:
|
|
519
524
|
"""Build VALUES statement.
|
|
520
525
|
|
|
@@ -962,7 +967,7 @@ def func(name: str, *args, copy: bool = True, dialect: DialectType = None, **kwa
|
|
|
962
967
|
|
|
963
968
|
def case(
|
|
964
969
|
expression: t.Optional[ExpOrStr] = None,
|
|
965
|
-
**opts,
|
|
970
|
+
**opts: t.Any,
|
|
966
971
|
) -> Case:
|
|
967
972
|
"""
|
|
968
973
|
Initialize a CASE statement.
|