sqlspec 0.63.1__py3-none-any.whl → 0.65.0__py3-none-any.whl
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.
- sqlspec/__init__.py +193 -73
- sqlspec/_typing.py +6 -4
- sqlspec/adapters/adbc/_typing.py +31 -5
- sqlspec/adapters/adbc/adk/store.py +130 -59
- sqlspec/adapters/adbc/config.py +48 -2
- sqlspec/adapters/adbc/core.py +138 -21
- sqlspec/adapters/adbc/data_dictionary.py +235 -237
- sqlspec/adapters/adbc/driver.py +10 -29
- sqlspec/adapters/aiomysql/__init__.py +2 -0
- sqlspec/adapters/aiomysql/_typing.py +21 -7
- sqlspec/adapters/aiomysql/adk/store.py +17 -15
- sqlspec/adapters/aiomysql/config.py +81 -26
- sqlspec/adapters/aiomysql/core.py +46 -501
- sqlspec/adapters/aiomysql/data_dictionary.py +4 -290
- sqlspec/adapters/aiomysql/driver.py +64 -51
- sqlspec/adapters/aiomysql/litestar/__init__.py +2 -2
- sqlspec/adapters/aiomysql/litestar/store.py +20 -6
- sqlspec/adapters/aiosqlite/__init__.py +4 -1
- sqlspec/adapters/aiosqlite/_typing.py +7 -4
- sqlspec/adapters/aiosqlite/adk/store.py +106 -77
- sqlspec/adapters/aiosqlite/config.py +43 -72
- sqlspec/adapters/aiosqlite/core.py +170 -19
- sqlspec/adapters/aiosqlite/data_dictionary.py +0 -2
- sqlspec/adapters/aiosqlite/driver.py +83 -60
- sqlspec/adapters/aiosqlite/events/__init__.py +2 -2
- sqlspec/adapters/aiosqlite/events/store.py +18 -4
- sqlspec/adapters/aiosqlite/litestar/__init__.py +2 -2
- sqlspec/adapters/aiosqlite/litestar/store.py +33 -14
- sqlspec/adapters/aiosqlite/pool.py +120 -84
- sqlspec/adapters/aiosqlite/type_converter.py +30 -30
- sqlspec/adapters/arrow_odbc/_typing.py +10 -6
- sqlspec/adapters/arrow_odbc/adk/store.py +511 -168
- sqlspec/adapters/arrow_odbc/config.py +64 -16
- sqlspec/adapters/arrow_odbc/core.py +392 -25
- sqlspec/adapters/arrow_odbc/data_dictionary.py +41 -40
- sqlspec/adapters/arrow_odbc/driver.py +220 -60
- sqlspec/adapters/arrow_odbc/events/store.py +43 -18
- sqlspec/adapters/arrow_odbc/litestar/store.py +222 -54
- sqlspec/adapters/arrow_odbc/type_converter.py +9 -0
- sqlspec/adapters/asyncmy/__init__.py +2 -0
- sqlspec/adapters/asyncmy/_typing.py +32 -26
- sqlspec/adapters/asyncmy/adk/store.py +17 -14
- sqlspec/adapters/asyncmy/config.py +75 -26
- sqlspec/adapters/asyncmy/core.py +47 -522
- sqlspec/adapters/asyncmy/data_dictionary.py +4 -291
- sqlspec/adapters/asyncmy/driver.py +57 -46
- sqlspec/adapters/asyncmy/litestar/__init__.py +2 -2
- sqlspec/adapters/asyncmy/litestar/store.py +21 -7
- sqlspec/adapters/asyncpg/__init__.py +2 -1
- sqlspec/adapters/asyncpg/_typing.py +50 -7
- sqlspec/adapters/asyncpg/adk/store.py +29 -8
- sqlspec/adapters/asyncpg/config.py +84 -29
- sqlspec/adapters/asyncpg/core.py +63 -16
- sqlspec/adapters/asyncpg/data_dictionary.py +100 -101
- sqlspec/adapters/asyncpg/driver.py +63 -51
- sqlspec/adapters/asyncpg/events/__init__.py +2 -2
- sqlspec/adapters/asyncpg/events/backend.py +45 -45
- sqlspec/adapters/asyncpg/events/store.py +21 -1
- sqlspec/adapters/asyncpg/litestar/__init__.py +2 -2
- sqlspec/adapters/asyncpg/litestar/store.py +37 -11
- sqlspec/adapters/bigquery/__init__.py +7 -1
- sqlspec/adapters/bigquery/_typing.py +37 -17
- sqlspec/adapters/bigquery/adk/store.py +1 -3
- sqlspec/adapters/bigquery/config.py +151 -33
- sqlspec/adapters/bigquery/core.py +151 -116
- sqlspec/adapters/bigquery/driver.py +89 -93
- sqlspec/adapters/bigquery/events/__init__.py +2 -2
- sqlspec/adapters/bigquery/events/store.py +17 -1
- sqlspec/adapters/bigquery/litestar/__init__.py +2 -2
- sqlspec/adapters/bigquery/litestar/store.py +39 -6
- sqlspec/adapters/cockroach_asyncpg/__init__.py +2 -0
- sqlspec/adapters/cockroach_asyncpg/_typing.py +13 -7
- sqlspec/adapters/cockroach_asyncpg/adk/store.py +1 -1
- sqlspec/adapters/cockroach_asyncpg/config.py +57 -14
- sqlspec/adapters/cockroach_asyncpg/core.py +106 -12
- sqlspec/adapters/cockroach_asyncpg/data_dictionary.py +97 -97
- sqlspec/adapters/cockroach_asyncpg/driver.py +47 -17
- sqlspec/adapters/cockroach_asyncpg/litestar/__init__.py +2 -2
- sqlspec/adapters/cockroach_asyncpg/litestar/store.py +21 -2
- sqlspec/adapters/cockroach_psycopg/__init__.py +2 -0
- sqlspec/adapters/cockroach_psycopg/_typing.py +23 -9
- sqlspec/adapters/cockroach_psycopg/adk/store.py +40 -13
- sqlspec/adapters/cockroach_psycopg/config.py +179 -83
- sqlspec/adapters/cockroach_psycopg/core.py +125 -12
- sqlspec/adapters/cockroach_psycopg/data_dictionary.py +97 -97
- sqlspec/adapters/cockroach_psycopg/driver.py +112 -41
- sqlspec/adapters/cockroach_psycopg/litestar/__init__.py +6 -2
- sqlspec/adapters/cockroach_psycopg/litestar/store.py +21 -3
- sqlspec/adapters/db2/__init__.py +31 -0
- sqlspec/adapters/db2/_typing.py +311 -0
- sqlspec/adapters/db2/adk/__init__.py +10 -0
- sqlspec/adapters/db2/adk/store.py +1334 -0
- sqlspec/adapters/db2/config.py +460 -0
- sqlspec/adapters/db2/core.py +753 -0
- sqlspec/adapters/db2/data_dictionary.py +478 -0
- sqlspec/adapters/db2/driver.py +674 -0
- sqlspec/adapters/db2/events/__init__.py +6 -0
- sqlspec/adapters/db2/events/config.py +9 -0
- sqlspec/adapters/db2/events/store.py +67 -0
- sqlspec/adapters/db2/litestar/__init__.py +6 -0
- sqlspec/adapters/db2/litestar/config.py +12 -0
- sqlspec/adapters/db2/litestar/store.py +465 -0
- sqlspec/adapters/db2/migrations.py +191 -0
- sqlspec/adapters/db2/pool.py +564 -0
- sqlspec/adapters/duckdb/__init__.py +2 -1
- sqlspec/adapters/duckdb/_typing.py +28 -5
- sqlspec/adapters/duckdb/adk/store.py +30 -15
- sqlspec/adapters/duckdb/config.py +44 -62
- sqlspec/adapters/duckdb/core.py +271 -258
- sqlspec/adapters/duckdb/driver.py +63 -54
- sqlspec/adapters/duckdb/litestar/store.py +3 -3
- sqlspec/adapters/duckdb/pool.py +61 -60
- sqlspec/adapters/mssql_python/_typing.py +9 -3
- sqlspec/adapters/mssql_python/adk/store.py +49 -28
- sqlspec/adapters/mssql_python/config.py +18 -16
- sqlspec/adapters/mssql_python/core.py +118 -20
- sqlspec/adapters/mssql_python/data_dictionary.py +1 -41
- sqlspec/adapters/mssql_python/driver.py +114 -24
- sqlspec/adapters/mssql_python/events/store.py +5 -24
- sqlspec/adapters/mssql_python/litestar/store.py +18 -47
- sqlspec/adapters/mssql_python/pool.py +3 -2
- sqlspec/adapters/mssql_python/type_converter.py +1 -0
- sqlspec/adapters/mysql_common.py +502 -0
- sqlspec/adapters/mysqlconnector/__init__.py +2 -0
- sqlspec/adapters/mysqlconnector/_typing.py +10 -4
- sqlspec/adapters/mysqlconnector/adk/store.py +27 -34
- sqlspec/adapters/mysqlconnector/config.py +141 -41
- sqlspec/adapters/mysqlconnector/core.py +57 -448
- sqlspec/adapters/mysqlconnector/data_dictionary.py +6 -549
- sqlspec/adapters/mysqlconnector/driver.py +47 -44
- sqlspec/adapters/mysqlconnector/litestar/__init__.py +6 -2
- sqlspec/adapters/mysqlconnector/litestar/store.py +24 -13
- sqlspec/adapters/oracledb/__init__.py +8 -2
- sqlspec/adapters/oracledb/_json_handlers.py +61 -20
- sqlspec/adapters/oracledb/_storage.py +6 -4
- sqlspec/adapters/oracledb/_typing.py +29 -11
- sqlspec/adapters/oracledb/_uuid_handlers.py +36 -33
- sqlspec/adapters/oracledb/_vector_handlers.py +42 -29
- sqlspec/adapters/oracledb/adk/store.py +238 -270
- sqlspec/adapters/oracledb/config.py +47 -43
- sqlspec/adapters/oracledb/core.py +209 -121
- sqlspec/adapters/oracledb/driver.py +113 -91
- sqlspec/adapters/oracledb/events/__init__.py +10 -1
- sqlspec/adapters/oracledb/events/_hub.py +34 -73
- sqlspec/adapters/oracledb/events/backend.py +49 -94
- sqlspec/adapters/oracledb/events/store.py +84 -12
- sqlspec/adapters/oracledb/litestar/__init__.py +14 -2
- sqlspec/adapters/oracledb/litestar/store.py +186 -204
- sqlspec/adapters/oracledb/migrations.py +1 -5
- sqlspec/adapters/oracledb/type_converter.py +10 -7
- sqlspec/adapters/psqlpy/__init__.py +2 -1
- sqlspec/adapters/psqlpy/_typing.py +36 -3
- sqlspec/adapters/psqlpy/adk/store.py +76 -49
- sqlspec/adapters/psqlpy/config.py +25 -16
- sqlspec/adapters/psqlpy/core.py +80 -107
- sqlspec/adapters/psqlpy/data_dictionary.py +100 -100
- sqlspec/adapters/psqlpy/driver.py +36 -47
- sqlspec/adapters/psqlpy/events/__init__.py +8 -2
- sqlspec/adapters/psqlpy/events/store.py +17 -1
- sqlspec/adapters/psqlpy/litestar/__init__.py +2 -2
- sqlspec/adapters/psqlpy/litestar/store.py +40 -19
- sqlspec/adapters/psqlpy/type_converter.py +18 -4
- sqlspec/adapters/psycopg/__init__.py +2 -0
- sqlspec/adapters/psycopg/_typing.py +68 -2
- sqlspec/adapters/psycopg/adk/store.py +79 -22
- sqlspec/adapters/psycopg/config.py +213 -99
- sqlspec/adapters/psycopg/core.py +56 -51
- sqlspec/adapters/psycopg/data_dictionary.py +100 -102
- sqlspec/adapters/psycopg/driver.py +83 -107
- sqlspec/adapters/psycopg/events/__init__.py +6 -1
- sqlspec/adapters/psycopg/events/store.py +22 -1
- sqlspec/adapters/psycopg/litestar/__init__.py +2 -2
- sqlspec/adapters/psycopg/litestar/store.py +20 -2
- sqlspec/adapters/psycopg/type_converter.py +4 -7
- sqlspec/adapters/pymssql/__init__.py +2 -1
- sqlspec/adapters/pymssql/_typing.py +15 -3
- sqlspec/adapters/pymssql/adk/store.py +28 -36
- sqlspec/adapters/pymssql/config.py +16 -7
- sqlspec/adapters/pymssql/core.py +53 -16
- sqlspec/adapters/pymssql/data_dictionary.py +1 -41
- sqlspec/adapters/pymssql/driver.py +11 -20
- sqlspec/adapters/pymssql/events/store.py +5 -24
- sqlspec/adapters/pymssql/litestar/store.py +18 -47
- sqlspec/adapters/pymssql/pool.py +49 -13
- sqlspec/adapters/pymysql/__init__.py +2 -0
- sqlspec/adapters/pymysql/_typing.py +26 -8
- sqlspec/adapters/pymysql/adk/store.py +14 -11
- sqlspec/adapters/pymysql/config.py +45 -14
- sqlspec/adapters/pymysql/core.py +45 -443
- sqlspec/adapters/pymysql/data_dictionary.py +5 -288
- sqlspec/adapters/pymysql/driver.py +62 -30
- sqlspec/adapters/pymysql/litestar/__init__.py +2 -2
- sqlspec/adapters/pymysql/litestar/store.py +22 -11
- sqlspec/adapters/pymysql/pool.py +63 -15
- sqlspec/adapters/spanner/__init__.py +2 -0
- sqlspec/adapters/spanner/_typing.py +87 -0
- sqlspec/adapters/spanner/adk/store.py +29 -27
- sqlspec/adapters/spanner/config.py +94 -28
- sqlspec/adapters/spanner/core.py +26 -17
- sqlspec/adapters/spanner/data_dictionary.py +132 -18
- sqlspec/adapters/spanner/driver.py +67 -51
- sqlspec/adapters/spanner/litestar/__init__.py +2 -2
- sqlspec/adapters/spanner/litestar/store.py +21 -4
- sqlspec/adapters/spanner/type_converter.py +113 -48
- sqlspec/adapters/sqlite/__init__.py +4 -1
- sqlspec/adapters/sqlite/_typing.py +12 -5
- sqlspec/adapters/sqlite/adk/store.py +79 -76
- sqlspec/adapters/sqlite/config.py +44 -68
- sqlspec/adapters/sqlite/core.py +117 -28
- sqlspec/adapters/sqlite/data_dictionary.py +0 -2
- sqlspec/adapters/sqlite/driver.py +106 -66
- sqlspec/adapters/sqlite/events/__init__.py +2 -2
- sqlspec/adapters/sqlite/events/store.py +18 -4
- sqlspec/adapters/sqlite/litestar/__init__.py +2 -2
- sqlspec/adapters/sqlite/litestar/store.py +29 -13
- sqlspec/adapters/sqlite/pool.py +188 -114
- sqlspec/adapters/sqlite/type_converter.py +30 -30
- sqlspec/builder/__init__.py +215 -90
- sqlspec/builder/_base.py +105 -89
- sqlspec/builder/_column.py +21 -6
- sqlspec/builder/_ddl.py +37 -22
- sqlspec/builder/_dml.py +18 -22
- sqlspec/builder/_expression_wrappers.py +8 -1
- sqlspec/builder/_factory.py +106 -106
- sqlspec/builder/_insert.py +1 -1
- sqlspec/builder/_join.py +100 -100
- sqlspec/builder/_locking.py +12 -12
- sqlspec/builder/_merge.py +140 -45
- sqlspec/builder/_parsing_utils.py +73 -40
- sqlspec/builder/_select.py +50 -59
- sqlspec/builder/_temporal.py +48 -48
- sqlspec/builder/_vector_distance.py +19 -19
- sqlspec/config.py +145 -229
- sqlspec/core/__init__.py +18 -1
- sqlspec/core/_cursor.py +263 -0
- sqlspec/core/_operators.py +161 -0
- sqlspec/core/_ordering.py +151 -0
- sqlspec/core/_pagination.py +27 -3
- sqlspec/core/_pipeline.py +73 -73
- sqlspec/core/_pool.py +12 -12
- sqlspec/core/compiler.py +4 -10
- sqlspec/core/correlation.py +0 -1
- sqlspec/core/filters.py +407 -29
- sqlspec/core/hashing.py +28 -23
- sqlspec/core/parameters/__init__.py +4 -1
- sqlspec/core/parameters/_converter.py +389 -123
- sqlspec/core/parameters/_declared.py +5 -5
- sqlspec/core/parameters/_processor.py +302 -86
- sqlspec/core/parameters/_registry.py +36 -36
- sqlspec/core/parameters/_transformers.py +116 -116
- sqlspec/core/parameters/_types.py +29 -29
- sqlspec/core/parameters/_validator.py +113 -1
- sqlspec/core/query_modifiers.py +40 -29
- sqlspec/core/splitter.py +62 -53
- sqlspec/core/sqlcommenter.py +96 -96
- sqlspec/core/statement.py +135 -71
- sqlspec/data_dictionary/_registry.py +12 -9
- sqlspec/data_dictionary/_types.py +38 -30
- sqlspec/data_dictionary/dialects/__init__.py +2 -0
- sqlspec/data_dictionary/dialects/db2/__init__.py +31 -0
- sqlspec/data_dictionary/dialects/db2/config.py +172 -0
- sqlspec/data_dictionary/dialects/db2/sql/columns.sql +66 -0
- sqlspec/data_dictionary/dialects/db2/sql/constraints.sql +49 -0
- sqlspec/data_dictionary/dialects/db2/sql/foreign_keys.sql +43 -0
- sqlspec/data_dictionary/dialects/db2/sql/indexes.sql +39 -0
- sqlspec/data_dictionary/dialects/db2/sql/objects.sql +53 -0
- sqlspec/data_dictionary/dialects/db2/sql/schemas.sql +17 -0
- sqlspec/data_dictionary/dialects/db2/sql/tables.sql +87 -0
- sqlspec/data_dictionary/dialects/db2/sql/version.sql +8 -0
- sqlspec/data_dictionary/dialects/db2/sql/views.sql +15 -0
- sqlspec/data_dictionary/dialects/mssql/__init__.py +2 -0
- sqlspec/data_dictionary/dialects/mssql/config.py +41 -1
- sqlspec/data_dictionary/dialects/mysql/__init__.py +3 -0
- sqlspec/data_dictionary/dialects/mysql/config.py +32 -32
- sqlspec/data_dictionary/dialects/mysql/dictionary.py +583 -0
- sqlspec/data_dictionary/dialects/spanner/config.py +2 -0
- sqlspec/data_dictionary/dialects/spanner/sql/foreign_keys.sql +23 -2
- sqlspec/data_dictionary/dialects/spanner/sql/googlesql/columns.sql +39 -16
- sqlspec/data_dictionary/dialects/spanner/sql/googlesql/constraints.sql +32 -0
- sqlspec/data_dictionary/dialects/spanner/sql/googlesql/foreign_keys.sql +91 -0
- sqlspec/data_dictionary/dialects/spanner/sql/googlesql/indexes.sql +36 -3
- sqlspec/data_dictionary/dialects/spanner/sql/googlesql/tables.sql +23 -8
- sqlspec/data_dictionary/dialects/spanner/sql/postgresql/change_streams.sql +28 -0
- sqlspec/data_dictionary/dialects/spanner/sql/postgresql/columns.sql +34 -0
- sqlspec/data_dictionary/dialects/spanner/sql/postgresql/constraints.sql +63 -0
- sqlspec/data_dictionary/dialects/spanner/sql/postgresql/foreign_keys.sql +91 -0
- sqlspec/data_dictionary/dialects/spanner/sql/postgresql/indexes.sql +52 -0
- sqlspec/data_dictionary/dialects/spanner/sql/postgresql/sequences.sql +14 -0
- sqlspec/data_dictionary/dialects/spanner/sql/postgresql/system.sql +27 -0
- sqlspec/data_dictionary/dialects/spanner/sql/postgresql/tables.sql +22 -0
- sqlspec/dialects/__init__.py +3 -1
- sqlspec/dialects/db2/__init__.py +110 -0
- sqlspec/dialects/db2/_generators.py +352 -0
- sqlspec/dialects/db2/_parsers.py +558 -0
- sqlspec/dialects/db2/_transforms.py +164 -0
- sqlspec/dialects/postgres/_operators.py +17 -17
- sqlspec/dialects/spanner/_expressions.py +78 -0
- sqlspec/dialects/spanner/_generators.py +481 -36
- sqlspec/dialects/spanner/_parsers.py +379 -43
- sqlspec/dialects/spanner/_spangres.py +19 -22
- sqlspec/dialects/spanner/_spanner.py +27 -23
- sqlspec/driver/__init__.py +8 -0
- sqlspec/driver/_async.py +0 -40
- sqlspec/driver/_common.py +101 -99
- sqlspec/driver/_exception_handler.py +32 -32
- sqlspec/driver/_stream.py +22 -27
- sqlspec/driver/_sync.py +1 -41
- sqlspec/exceptions.py +5 -5
- sqlspec/extensions/adk/artifact/service.py +0 -1
- sqlspec/extensions/adk/converters.py +0 -15
- sqlspec/extensions/adk/maintenance.py +74 -74
- sqlspec/extensions/adk/memory/converters.py +8 -10
- sqlspec/extensions/adk/memory/service.py +99 -3
- sqlspec/extensions/adk/service.py +9 -13
- sqlspec/extensions/events/__init__.py +96 -32
- sqlspec/extensions/events/_channel.py +29 -0
- sqlspec/extensions/events/_payload.py +19 -19
- sqlspec/extensions/events/_queue.py +3 -1
- sqlspec/extensions/events/_store.py +5 -3
- sqlspec/extensions/events/primitives.py +11 -2
- sqlspec/extensions/fastapi/providers.py +164 -26
- sqlspec/extensions/litestar/plugin.py +3 -5
- sqlspec/extensions/litestar/providers.py +183 -30
- sqlspec/extensions/litestar/store.py +0 -1
- sqlspec/extensions/starlette/extension.py +0 -2
- sqlspec/extensions/starlette/middleware.py +1 -1
- sqlspec/loader.py +12 -12
- sqlspec/migrations/__init__.py +72 -13
- sqlspec/migrations/base.py +73 -46
- sqlspec/migrations/commands.py +7 -7
- sqlspec/migrations/runner.py +7 -3
- sqlspec/migrations/schema.py +56 -20
- sqlspec/migrations/squash.py +0 -11
- sqlspec/migrations/tracker.py +22 -8
- sqlspec/migrations/version.py +9 -9
- sqlspec/observability/_common.py +1 -0
- sqlspec/observability/_observer.py +55 -55
- sqlspec/observability/_sampling.py +0 -3
- sqlspec/protocols.py +1 -0
- sqlspec/service/_base.py +358 -11
- sqlspec/service/_core.py +100 -6
- sqlspec/storage/_paths.py +33 -33
- sqlspec/storage/backends/base.py +19 -19
- sqlspec/storage/backends/fsspec.py +0 -1
- sqlspec/storage/backends/obstore.py +75 -75
- sqlspec/storage/errors.py +29 -29
- sqlspec/storage/pipeline.py +136 -136
- sqlspec/storage/registry.py +0 -3
- sqlspec/typing.py +2 -0
- sqlspec/utils/config_tools.py +164 -75
- sqlspec/utils/correlation.py +6 -6
- sqlspec/utils/deprecation.py +13 -13
- sqlspec/utils/env.py +17 -17
- sqlspec/utils/fixtures.py +284 -114
- sqlspec/utils/module_loader.py +30 -39
- sqlspec/utils/schema.py +112 -127
- sqlspec/utils/serializers/_json.py +42 -45
- sqlspec/utils/serializers/_schema.py +92 -92
- sqlspec/utils/sync_tools.py +90 -90
- sqlspec/utils/text.py +1 -1
- sqlspec/utils/type_converters.py +49 -49
- sqlspec/utils/type_guards.py +28 -34
- {sqlspec-0.63.1.dist-info → sqlspec-0.65.0.dist-info}/METADATA +7 -4
- {sqlspec-0.63.1.dist-info → sqlspec-0.65.0.dist-info}/RECORD +367 -321
- {sqlspec-0.63.1.dist-info → sqlspec-0.65.0.dist-info}/WHEEL +1 -1
- {sqlspec-0.63.1.dist-info → sqlspec-0.65.0.dist-info}/entry_points.txt +1 -0
- {sqlspec-0.63.1.dist-info → sqlspec-0.65.0.dist-info}/licenses/LICENSE +0 -0
sqlspec/__init__.py
CHANGED
|
@@ -13,79 +13,98 @@ _warnings.filterwarnings(
|
|
|
13
13
|
)
|
|
14
14
|
del _warnings
|
|
15
15
|
|
|
16
|
+
from importlib import import_module
|
|
17
|
+
from importlib.machinery import EXTENSION_SUFFIXES
|
|
16
18
|
from typing import TYPE_CHECKING, Any
|
|
17
19
|
|
|
18
|
-
from sqlspec import adapters, base, builder, core, driver, exceptions, extensions, loader, migrations, typing, utils
|
|
19
20
|
from sqlspec.__metadata__ import __version__
|
|
20
|
-
from sqlspec.
|
|
21
|
-
from sqlspec.builder import (
|
|
22
|
-
Column,
|
|
23
|
-
ColumnExpression,
|
|
24
|
-
CreateTable,
|
|
25
|
-
Delete,
|
|
26
|
-
DropTable,
|
|
27
|
-
FunctionColumn,
|
|
28
|
-
Insert,
|
|
29
|
-
Merge,
|
|
30
|
-
QueryBuilder,
|
|
31
|
-
Select,
|
|
32
|
-
SQLFactory,
|
|
33
|
-
Update,
|
|
34
|
-
sql,
|
|
35
|
-
)
|
|
36
|
-
from sqlspec.config import AsyncDatabaseConfig, SyncDatabaseConfig
|
|
37
|
-
from sqlspec.core import (
|
|
38
|
-
SQL,
|
|
39
|
-
ArrowResult,
|
|
40
|
-
CacheConfig,
|
|
41
|
-
CacheStats,
|
|
42
|
-
ParameterConverter,
|
|
43
|
-
ParameterDeclaration,
|
|
44
|
-
ParameterProcessor,
|
|
45
|
-
ParameterStyle,
|
|
46
|
-
ParameterStyleConfig,
|
|
47
|
-
ParamTypeMatcher,
|
|
48
|
-
ProcessedState,
|
|
49
|
-
SQLResult,
|
|
50
|
-
StackOperation,
|
|
51
|
-
StackResult,
|
|
52
|
-
Statement,
|
|
53
|
-
StatementConfig,
|
|
54
|
-
StatementStack,
|
|
55
|
-
matches_param_type,
|
|
56
|
-
register_param_type,
|
|
57
|
-
resolve_param_type,
|
|
58
|
-
)
|
|
59
|
-
from sqlspec.core import filters as filters
|
|
60
|
-
from sqlspec.driver import AsyncDriverAdapterBase, ExecutionResult, SyncDriverAdapterBase
|
|
61
|
-
from sqlspec.exceptions import StackExecutionError
|
|
62
|
-
from sqlspec.extensions.events import (
|
|
63
|
-
AsyncEventChannel,
|
|
64
|
-
AsyncEventListener,
|
|
65
|
-
EventMessage,
|
|
66
|
-
SyncEventChannel,
|
|
67
|
-
SyncEventListener,
|
|
68
|
-
)
|
|
69
|
-
from sqlspec.loader import SQLFile, SQLFileLoader
|
|
70
|
-
from sqlspec.observability import (
|
|
71
|
-
LoggingConfig,
|
|
72
|
-
ObservabilityConfig,
|
|
73
|
-
ObservabilityRuntime,
|
|
74
|
-
RedactionConfig,
|
|
75
|
-
StatementEvent,
|
|
76
|
-
StatementObserver,
|
|
77
|
-
TelemetryConfig,
|
|
78
|
-
create_event,
|
|
79
|
-
create_statement_observer,
|
|
80
|
-
default_statement_observer,
|
|
81
|
-
format_statement_event,
|
|
82
|
-
)
|
|
83
|
-
from sqlspec.typing import ConnectionT, PoolT, SchemaT, StatementParameters, SupportedSchemaModel
|
|
21
|
+
from sqlspec.utils import logging as _logging
|
|
84
22
|
from sqlspec.utils.logging import suppress_erroneous_sqlglot_log_messages
|
|
85
|
-
|
|
23
|
+
|
|
24
|
+
_COMPILED = (_logging.__file__ or "").endswith(tuple(EXTENSION_SUFFIXES))
|
|
86
25
|
|
|
87
26
|
if TYPE_CHECKING:
|
|
88
|
-
from sqlspec import
|
|
27
|
+
from sqlspec import (
|
|
28
|
+
adapters,
|
|
29
|
+
base,
|
|
30
|
+
builder,
|
|
31
|
+
core,
|
|
32
|
+
dialects,
|
|
33
|
+
driver,
|
|
34
|
+
exceptions,
|
|
35
|
+
extensions,
|
|
36
|
+
loader,
|
|
37
|
+
migrations,
|
|
38
|
+
typing,
|
|
39
|
+
utils,
|
|
40
|
+
)
|
|
41
|
+
from sqlspec import config as config
|
|
42
|
+
from sqlspec import observability as observability
|
|
43
|
+
from sqlspec.base import SQLSpec
|
|
44
|
+
from sqlspec.builder import (
|
|
45
|
+
Column,
|
|
46
|
+
ColumnExpression,
|
|
47
|
+
CreateTable,
|
|
48
|
+
Delete,
|
|
49
|
+
DropTable,
|
|
50
|
+
FunctionColumn,
|
|
51
|
+
Insert,
|
|
52
|
+
Merge,
|
|
53
|
+
QueryBuilder,
|
|
54
|
+
Select,
|
|
55
|
+
SQLFactory,
|
|
56
|
+
Update,
|
|
57
|
+
sql,
|
|
58
|
+
)
|
|
59
|
+
from sqlspec.config import AsyncDatabaseConfig, SyncDatabaseConfig
|
|
60
|
+
from sqlspec.core import (
|
|
61
|
+
SQL,
|
|
62
|
+
ArrowResult,
|
|
63
|
+
CacheConfig,
|
|
64
|
+
CacheStats,
|
|
65
|
+
ParameterConverter,
|
|
66
|
+
ParameterDeclaration,
|
|
67
|
+
ParameterProcessor,
|
|
68
|
+
ParameterStyle,
|
|
69
|
+
ParameterStyleConfig,
|
|
70
|
+
ParamTypeMatcher,
|
|
71
|
+
ProcessedState,
|
|
72
|
+
SQLResult,
|
|
73
|
+
StackOperation,
|
|
74
|
+
StackResult,
|
|
75
|
+
Statement,
|
|
76
|
+
StatementConfig,
|
|
77
|
+
StatementStack,
|
|
78
|
+
matches_param_type,
|
|
79
|
+
register_param_type,
|
|
80
|
+
resolve_param_type,
|
|
81
|
+
)
|
|
82
|
+
from sqlspec.core import filters as filters
|
|
83
|
+
from sqlspec.driver import AsyncDriverAdapterBase, ExecutionResult, SyncDriverAdapterBase
|
|
84
|
+
from sqlspec.exceptions import StackExecutionError
|
|
85
|
+
from sqlspec.extensions.events import (
|
|
86
|
+
AsyncEventChannel,
|
|
87
|
+
AsyncEventListener,
|
|
88
|
+
EventMessage,
|
|
89
|
+
SyncEventChannel,
|
|
90
|
+
SyncEventListener,
|
|
91
|
+
)
|
|
92
|
+
from sqlspec.loader import SQLFile, SQLFileLoader
|
|
93
|
+
from sqlspec.observability import (
|
|
94
|
+
LoggingConfig,
|
|
95
|
+
ObservabilityConfig,
|
|
96
|
+
ObservabilityRuntime,
|
|
97
|
+
RedactionConfig,
|
|
98
|
+
StatementEvent,
|
|
99
|
+
StatementObserver,
|
|
100
|
+
TelemetryConfig,
|
|
101
|
+
create_event,
|
|
102
|
+
create_statement_observer,
|
|
103
|
+
default_statement_observer,
|
|
104
|
+
format_statement_event,
|
|
105
|
+
)
|
|
106
|
+
from sqlspec.typing import ConnectionT, PoolT, SchemaT, StatementParameters, SupportedSchemaModel
|
|
107
|
+
from sqlspec.utils.uuids import nanoid, uuid4, uuid6, uuid7
|
|
89
108
|
|
|
90
109
|
__all__ = (
|
|
91
110
|
"SQL",
|
|
@@ -174,10 +193,111 @@ __all__ = (
|
|
|
174
193
|
suppress_erroneous_sqlglot_log_messages()
|
|
175
194
|
|
|
176
195
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
196
|
+
_EXPORTS: dict[str, tuple[str, str | None]] = {
|
|
197
|
+
"ArrowResult": ("sqlspec.core", "ArrowResult"),
|
|
198
|
+
"AsyncDatabaseConfig": ("sqlspec.config", "AsyncDatabaseConfig"),
|
|
199
|
+
"AsyncDriverAdapterBase": ("sqlspec.driver", "AsyncDriverAdapterBase"),
|
|
200
|
+
"AsyncEventChannel": ("sqlspec.extensions.events", "AsyncEventChannel"),
|
|
201
|
+
"AsyncEventListener": ("sqlspec.extensions.events", "AsyncEventListener"),
|
|
202
|
+
"CacheConfig": ("sqlspec.core", "CacheConfig"),
|
|
203
|
+
"CacheStats": ("sqlspec.core", "CacheStats"),
|
|
204
|
+
"Column": ("sqlspec.builder", "Column"),
|
|
205
|
+
"ColumnExpression": ("sqlspec.builder", "ColumnExpression"),
|
|
206
|
+
"ConnectionT": ("sqlspec.typing", "ConnectionT"),
|
|
207
|
+
"CreateTable": ("sqlspec.builder", "CreateTable"),
|
|
208
|
+
"Delete": ("sqlspec.builder", "Delete"),
|
|
209
|
+
"DropTable": ("sqlspec.builder", "DropTable"),
|
|
210
|
+
"EventMessage": ("sqlspec.extensions.events", "EventMessage"),
|
|
211
|
+
"ExecutionResult": ("sqlspec.driver", "ExecutionResult"),
|
|
212
|
+
"FunctionColumn": ("sqlspec.builder", "FunctionColumn"),
|
|
213
|
+
"Insert": ("sqlspec.builder", "Insert"),
|
|
214
|
+
"LoggingConfig": ("sqlspec.observability", "LoggingConfig"),
|
|
215
|
+
"Merge": ("sqlspec.builder", "Merge"),
|
|
216
|
+
"ObservabilityConfig": ("sqlspec.observability", "ObservabilityConfig"),
|
|
217
|
+
"ObservabilityRuntime": ("sqlspec.observability", "ObservabilityRuntime"),
|
|
218
|
+
"ParamTypeMatcher": ("sqlspec.core", "ParamTypeMatcher"),
|
|
219
|
+
"ParameterConverter": ("sqlspec.core", "ParameterConverter"),
|
|
220
|
+
"ParameterDeclaration": ("sqlspec.core", "ParameterDeclaration"),
|
|
221
|
+
"ParameterProcessor": ("sqlspec.core", "ParameterProcessor"),
|
|
222
|
+
"ParameterStyle": ("sqlspec.core", "ParameterStyle"),
|
|
223
|
+
"ParameterStyleConfig": ("sqlspec.core", "ParameterStyleConfig"),
|
|
224
|
+
"PoolT": ("sqlspec.typing", "PoolT"),
|
|
225
|
+
"ProcessedState": ("sqlspec.core", "ProcessedState"),
|
|
226
|
+
"QueryBuilder": ("sqlspec.builder", "QueryBuilder"),
|
|
227
|
+
"RedactionConfig": ("sqlspec.observability", "RedactionConfig"),
|
|
228
|
+
"SQL": ("sqlspec.core", "SQL"),
|
|
229
|
+
"SQLFactory": ("sqlspec.builder", "SQLFactory"),
|
|
230
|
+
"SQLFile": ("sqlspec.loader", "SQLFile"),
|
|
231
|
+
"SQLFileLoader": ("sqlspec.loader", "SQLFileLoader"),
|
|
232
|
+
"SQLResult": ("sqlspec.core", "SQLResult"),
|
|
233
|
+
"SQLSpec": ("sqlspec.base", "SQLSpec"),
|
|
234
|
+
"SchemaT": ("sqlspec.typing", "SchemaT"),
|
|
235
|
+
"Select": ("sqlspec.builder", "Select"),
|
|
236
|
+
"StackExecutionError": ("sqlspec.exceptions", "StackExecutionError"),
|
|
237
|
+
"StackOperation": ("sqlspec.core", "StackOperation"),
|
|
238
|
+
"StackResult": ("sqlspec.core", "StackResult"),
|
|
239
|
+
"Statement": ("sqlspec.core", "Statement"),
|
|
240
|
+
"StatementConfig": ("sqlspec.core", "StatementConfig"),
|
|
241
|
+
"StatementEvent": ("sqlspec.observability", "StatementEvent"),
|
|
242
|
+
"StatementObserver": ("sqlspec.observability", "StatementObserver"),
|
|
243
|
+
"StatementParameters": ("sqlspec.typing", "StatementParameters"),
|
|
244
|
+
"StatementStack": ("sqlspec.core", "StatementStack"),
|
|
245
|
+
"SupportedSchemaModel": ("sqlspec.typing", "SupportedSchemaModel"),
|
|
246
|
+
"SyncDatabaseConfig": ("sqlspec.config", "SyncDatabaseConfig"),
|
|
247
|
+
"SyncDriverAdapterBase": ("sqlspec.driver", "SyncDriverAdapterBase"),
|
|
248
|
+
"SyncEventChannel": ("sqlspec.extensions.events", "SyncEventChannel"),
|
|
249
|
+
"SyncEventListener": ("sqlspec.extensions.events", "SyncEventListener"),
|
|
250
|
+
"TelemetryConfig": ("sqlspec.observability", "TelemetryConfig"),
|
|
251
|
+
"Update": ("sqlspec.builder", "Update"),
|
|
252
|
+
"adapters": ("sqlspec.adapters", None),
|
|
253
|
+
"base": ("sqlspec.base", None),
|
|
254
|
+
"builder": ("sqlspec.builder", None),
|
|
255
|
+
"config": ("sqlspec.config", None),
|
|
256
|
+
"core": ("sqlspec.core", None),
|
|
257
|
+
"create_event": ("sqlspec.observability", "create_event"),
|
|
258
|
+
"create_statement_observer": ("sqlspec.observability", "create_statement_observer"),
|
|
259
|
+
"default_statement_observer": ("sqlspec.observability", "default_statement_observer"),
|
|
260
|
+
"dialects": ("sqlspec.dialects", None),
|
|
261
|
+
"driver": ("sqlspec.driver", None),
|
|
262
|
+
"exceptions": ("sqlspec.exceptions", None),
|
|
263
|
+
"extensions": ("sqlspec.extensions", None),
|
|
264
|
+
"filters": ("sqlspec.core", "filters"),
|
|
265
|
+
"format_statement_event": ("sqlspec.observability", "format_statement_event"),
|
|
266
|
+
"loader": ("sqlspec.loader", None),
|
|
267
|
+
"matches_param_type": ("sqlspec.core", "matches_param_type"),
|
|
268
|
+
"migrations": ("sqlspec.migrations", None),
|
|
269
|
+
"nanoid": ("sqlspec.utils.uuids", "nanoid"),
|
|
270
|
+
"observability": ("sqlspec.observability", None),
|
|
271
|
+
"register_param_type": ("sqlspec.core", "register_param_type"),
|
|
272
|
+
"resolve_param_type": ("sqlspec.core", "resolve_param_type"),
|
|
273
|
+
"sql": ("sqlspec.builder._factory", "sql"),
|
|
274
|
+
"typing": ("sqlspec.typing", None),
|
|
275
|
+
"utils": ("sqlspec.utils", None),
|
|
276
|
+
"uuid4": ("sqlspec.utils.uuids", "uuid4"),
|
|
277
|
+
"uuid6": ("sqlspec.utils.uuids", "uuid6"),
|
|
278
|
+
"uuid7": ("sqlspec.utils.uuids", "uuid7"),
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def __getattr__(name: str) -> Any:
|
|
283
|
+
target = _EXPORTS.get(name)
|
|
284
|
+
if target is None:
|
|
285
|
+
msg = f"module {__name__!r} has no attribute {name!r}"
|
|
286
|
+
raise AttributeError(msg)
|
|
287
|
+
module_name, attribute = target
|
|
288
|
+
module = import_module(module_name)
|
|
289
|
+
value = module if attribute is None else getattr(module, attribute)
|
|
290
|
+
globals()[name] = value
|
|
291
|
+
return value
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
def __dir__() -> list[str]:
|
|
295
|
+
return sorted(set(globals()) | _EXPORTS.keys())
|
|
296
|
+
|
|
180
297
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
298
|
+
# Native cross-module initialization is not protected by Python import locks.
|
|
299
|
+
# Retain eager exports in compiled wheels until mypyc supports lazy concurrency.
|
|
300
|
+
if _COMPILED:
|
|
301
|
+
for _name in __all__:
|
|
302
|
+
if _name not in globals():
|
|
303
|
+
__getattr__(_name)
|
sqlspec/_typing.py
CHANGED
|
@@ -50,6 +50,7 @@ __all__ = (
|
|
|
50
50
|
"CATTRS_INSTALLED",
|
|
51
51
|
"CLOUD_SQL_CONNECTOR_INSTALLED",
|
|
52
52
|
"FSSPEC_INSTALLED",
|
|
53
|
+
"IBM_DB_INSTALLED",
|
|
53
54
|
"LITESTAR_INSTALLED",
|
|
54
55
|
"MSGSPEC_INSTALLED",
|
|
55
56
|
"NANOID_INSTALLED",
|
|
@@ -336,10 +337,6 @@ def attrs_define_stub(*args: Any, **kwargs: Any) -> Any: # noqa: ARG001
|
|
|
336
337
|
return _attrs_define_identity
|
|
337
338
|
|
|
338
339
|
|
|
339
|
-
def _attrs_define_identity(cls: Any) -> Any:
|
|
340
|
-
return cls
|
|
341
|
-
|
|
342
|
-
|
|
343
340
|
def attrs_field_stub(*args: Any, **kwargs: Any) -> Any: # noqa: ARG001
|
|
344
341
|
"""Placeholder implementation"""
|
|
345
342
|
return None
|
|
@@ -670,6 +667,7 @@ ATTRS_INSTALLED = dependency_flag("attrs")
|
|
|
670
667
|
CATTRS_INSTALLED = dependency_flag("cattrs")
|
|
671
668
|
CLOUD_SQL_CONNECTOR_INSTALLED = dependency_flag("google.cloud.sql.connector")
|
|
672
669
|
FSSPEC_INSTALLED = dependency_flag("fsspec")
|
|
670
|
+
IBM_DB_INSTALLED = dependency_flag("ibm_db")
|
|
673
671
|
LITESTAR_INSTALLED = dependency_flag("litestar")
|
|
674
672
|
MSGSPEC_INSTALLED = dependency_flag("msgspec")
|
|
675
673
|
NUMPY_INSTALLED = dependency_flag("numpy")
|
|
@@ -751,3 +749,7 @@ def __dir__() -> "list[str]":
|
|
|
751
749
|
"""Expose the public surface for autocomplete and ``dir()``."""
|
|
752
750
|
|
|
753
751
|
return sorted(set(globals()) | set(__all__))
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
def _attrs_define_identity(cls: Any) -> Any:
|
|
755
|
+
return cls
|
sqlspec/adapters/adbc/_typing.py
CHANGED
|
@@ -9,9 +9,13 @@ import contextlib
|
|
|
9
9
|
from typing import TYPE_CHECKING, Any
|
|
10
10
|
|
|
11
11
|
from adbc_driver_manager import Error as _AdbcNativeError
|
|
12
|
+
from adbc_driver_manager import NotSupportedError as AdbcNotSupportedError
|
|
13
|
+
from adbc_driver_manager import OperationalError as AdbcOperationalError
|
|
12
14
|
from adbc_driver_manager.dbapi import Connection
|
|
13
15
|
from adbc_driver_manager.dbapi import Cursor as _AdbcRawCursor
|
|
14
16
|
|
|
17
|
+
from sqlspec.typing import import_optional_attr
|
|
18
|
+
|
|
15
19
|
_AdbcConnection = Connection
|
|
16
20
|
|
|
17
21
|
if TYPE_CHECKING:
|
|
@@ -19,19 +23,29 @@ if TYPE_CHECKING:
|
|
|
19
23
|
from types import TracebackType
|
|
20
24
|
from typing import TypeAlias
|
|
21
25
|
|
|
26
|
+
from adbc_driver_flightsql import DatabaseOptions as AdbcFlightSqlDatabaseOptions
|
|
27
|
+
|
|
22
28
|
from sqlspec.adapters.adbc.driver import AdbcDriver
|
|
23
29
|
from sqlspec.core import StatementConfig
|
|
24
30
|
|
|
25
31
|
AdbcConnection: TypeAlias = _AdbcConnection
|
|
26
32
|
AdbcRawCursor: TypeAlias = _AdbcRawCursor
|
|
27
33
|
AdbcNativeError: TypeAlias = _AdbcNativeError
|
|
28
|
-
|
|
29
|
-
if not TYPE_CHECKING:
|
|
34
|
+
else:
|
|
30
35
|
AdbcConnection = _AdbcConnection
|
|
31
36
|
AdbcRawCursor = _AdbcRawCursor
|
|
32
37
|
AdbcNativeError = _AdbcNativeError
|
|
33
38
|
|
|
34
|
-
__all__ = (
|
|
39
|
+
__all__ = (
|
|
40
|
+
"AdbcConnection",
|
|
41
|
+
"AdbcCursor",
|
|
42
|
+
"AdbcFlightSqlDatabaseOptions",
|
|
43
|
+
"AdbcNativeError",
|
|
44
|
+
"AdbcNotSupportedError",
|
|
45
|
+
"AdbcOperationalError",
|
|
46
|
+
"AdbcRawCursor",
|
|
47
|
+
"AdbcSessionContext",
|
|
48
|
+
)
|
|
35
49
|
|
|
36
50
|
|
|
37
51
|
class AdbcCursor:
|
|
@@ -77,7 +91,7 @@ class AdbcSessionContext:
|
|
|
77
91
|
def __init__(
|
|
78
92
|
self,
|
|
79
93
|
acquire_connection: "Callable[[], Any]",
|
|
80
|
-
release_connection: "Callable[
|
|
94
|
+
release_connection: "Callable[..., Any]",
|
|
81
95
|
statement_config: "StatementConfig",
|
|
82
96
|
driver_features: "dict[str, Any]",
|
|
83
97
|
prepare_driver: "Callable[[AdbcDriver], AdbcDriver]",
|
|
@@ -108,6 +122,18 @@ class AdbcSessionContext:
|
|
|
108
122
|
self, exc_type: "type[BaseException] | None", exc_val: "BaseException | None", exc_tb: "TracebackType | None"
|
|
109
123
|
) -> "bool | None":
|
|
110
124
|
if self._connection is not None:
|
|
111
|
-
self._release_connection(self._connection)
|
|
125
|
+
self._release_connection(self._connection, exc_type=exc_type, exc_val=exc_val, exc_tb=exc_tb)
|
|
112
126
|
self._connection = None
|
|
113
127
|
return None
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def __getattr__(name: str) -> Any:
|
|
131
|
+
"""Load Flight SQL options only when that optional driver is used."""
|
|
132
|
+
if name != "AdbcFlightSqlDatabaseOptions":
|
|
133
|
+
msg = f"module {__name__!r} has no attribute {name!r}"
|
|
134
|
+
raise AttributeError(msg)
|
|
135
|
+
value = import_optional_attr("adbc_driver_flightsql", "DatabaseOptions")
|
|
136
|
+
if value is None:
|
|
137
|
+
msg = "Cannot import DatabaseOptions from adbc_driver_flightsql"
|
|
138
|
+
raise ImportError(msg)
|
|
139
|
+
return value
|