sqlspec 0.47.0__cp314-cp314-win_amd64.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.
- f68e0789eb443ecb1c2c__mypyc.cp314-win_amd64.pyd +0 -0
- sqlspec/__init__.py +167 -0
- sqlspec/__main__.py +12 -0
- sqlspec/__metadata__.py +14 -0
- sqlspec/_typing.py +714 -0
- sqlspec/adapters/__init__.py +0 -0
- sqlspec/adapters/adbc/__init__.py +13 -0
- sqlspec/adapters/adbc/_typing.py +106 -0
- sqlspec/adapters/adbc/adk/__init__.py +5 -0
- sqlspec/adapters/adbc/adk/store.py +1280 -0
- sqlspec/adapters/adbc/config.py +378 -0
- sqlspec/adapters/adbc/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/adbc/core.py +922 -0
- sqlspec/adapters/adbc/data_dictionary.py +339 -0
- sqlspec/adapters/adbc/driver.py +534 -0
- sqlspec/adapters/adbc/events/__init__.py +5 -0
- sqlspec/adapters/adbc/events/store.py +285 -0
- sqlspec/adapters/adbc/litestar/__init__.py +5 -0
- sqlspec/adapters/adbc/litestar/store.py +534 -0
- sqlspec/adapters/adbc/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/adbc/type_converter.py +142 -0
- sqlspec/adapters/aiomysql/__init__.py +21 -0
- sqlspec/adapters/aiomysql/_typing.py +137 -0
- sqlspec/adapters/aiomysql/adk/__init__.py +5 -0
- sqlspec/adapters/aiomysql/adk/store.py +678 -0
- sqlspec/adapters/aiomysql/config.py +305 -0
- sqlspec/adapters/aiomysql/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/aiomysql/core.py +536 -0
- sqlspec/adapters/aiomysql/data_dictionary.py +121 -0
- sqlspec/adapters/aiomysql/driver.py +386 -0
- sqlspec/adapters/aiomysql/events/__init__.py +5 -0
- sqlspec/adapters/aiomysql/events/store.py +104 -0
- sqlspec/adapters/aiomysql/litestar/__init__.py +5 -0
- sqlspec/adapters/aiomysql/litestar/store.py +314 -0
- sqlspec/adapters/aiosqlite/__init__.py +26 -0
- sqlspec/adapters/aiosqlite/_typing.py +109 -0
- sqlspec/adapters/aiosqlite/adk/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/adk/store.py +829 -0
- sqlspec/adapters/aiosqlite/config.py +315 -0
- sqlspec/adapters/aiosqlite/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/aiosqlite/core.py +315 -0
- sqlspec/adapters/aiosqlite/data_dictionary.py +202 -0
- sqlspec/adapters/aiosqlite/driver.py +311 -0
- sqlspec/adapters/aiosqlite/events/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/events/store.py +20 -0
- sqlspec/adapters/aiosqlite/litestar/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/litestar/store.py +279 -0
- sqlspec/adapters/aiosqlite/pool.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/aiosqlite/pool.py +734 -0
- sqlspec/adapters/asyncmy/__init__.py +21 -0
- sqlspec/adapters/asyncmy/_typing.py +113 -0
- sqlspec/adapters/asyncmy/adk/__init__.py +5 -0
- sqlspec/adapters/asyncmy/adk/store.py +644 -0
- sqlspec/adapters/asyncmy/config.py +307 -0
- sqlspec/adapters/asyncmy/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/asyncmy/core.py +538 -0
- sqlspec/adapters/asyncmy/data_dictionary.py +122 -0
- sqlspec/adapters/asyncmy/driver.py +391 -0
- sqlspec/adapters/asyncmy/events/__init__.py +5 -0
- sqlspec/adapters/asyncmy/events/store.py +104 -0
- sqlspec/adapters/asyncmy/litestar/__init__.py +5 -0
- sqlspec/adapters/asyncmy/litestar/store.py +296 -0
- sqlspec/adapters/asyncpg/__init__.py +26 -0
- sqlspec/adapters/asyncpg/_typing.py +103 -0
- sqlspec/adapters/asyncpg/adk/__init__.py +5 -0
- sqlspec/adapters/asyncpg/adk/store.py +483 -0
- sqlspec/adapters/asyncpg/config.py +575 -0
- sqlspec/adapters/asyncpg/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/asyncpg/core.py +480 -0
- sqlspec/adapters/asyncpg/data_dictionary.py +157 -0
- sqlspec/adapters/asyncpg/driver.py +487 -0
- sqlspec/adapters/asyncpg/events/__init__.py +6 -0
- sqlspec/adapters/asyncpg/events/_hub.py +181 -0
- sqlspec/adapters/asyncpg/events/backend.py +210 -0
- sqlspec/adapters/asyncpg/events/store.py +40 -0
- sqlspec/adapters/asyncpg/litestar/__init__.py +5 -0
- sqlspec/adapters/asyncpg/litestar/store.py +251 -0
- sqlspec/adapters/bigquery/__init__.py +15 -0
- sqlspec/adapters/bigquery/_typing.py +108 -0
- sqlspec/adapters/bigquery/config.py +362 -0
- sqlspec/adapters/bigquery/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/bigquery/core.py +768 -0
- sqlspec/adapters/bigquery/data_dictionary.py +120 -0
- sqlspec/adapters/bigquery/driver.py +542 -0
- sqlspec/adapters/bigquery/events/__init__.py +5 -0
- sqlspec/adapters/bigquery/events/store.py +139 -0
- sqlspec/adapters/bigquery/litestar/__init__.py +5 -0
- sqlspec/adapters/bigquery/litestar/store.py +325 -0
- sqlspec/adapters/bigquery/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/bigquery/type_converter.py +107 -0
- sqlspec/adapters/cockroach_asyncpg/__init__.py +26 -0
- sqlspec/adapters/cockroach_asyncpg/_typing.py +73 -0
- sqlspec/adapters/cockroach_asyncpg/adk/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/adk/store.py +465 -0
- sqlspec/adapters/cockroach_asyncpg/config.py +248 -0
- sqlspec/adapters/cockroach_asyncpg/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/cockroach_asyncpg/core.py +55 -0
- sqlspec/adapters/cockroach_asyncpg/data_dictionary.py +110 -0
- sqlspec/adapters/cockroach_asyncpg/driver.py +142 -0
- sqlspec/adapters/cockroach_asyncpg/events/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/events/store.py +20 -0
- sqlspec/adapters/cockroach_asyncpg/litestar/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/litestar/store.py +142 -0
- sqlspec/adapters/cockroach_psycopg/__init__.py +39 -0
- sqlspec/adapters/cockroach_psycopg/_typing.py +137 -0
- sqlspec/adapters/cockroach_psycopg/adk/__init__.py +13 -0
- sqlspec/adapters/cockroach_psycopg/adk/store.py +1039 -0
- sqlspec/adapters/cockroach_psycopg/config.py +511 -0
- sqlspec/adapters/cockroach_psycopg/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/cockroach_psycopg/core.py +63 -0
- sqlspec/adapters/cockroach_psycopg/data_dictionary.py +220 -0
- sqlspec/adapters/cockroach_psycopg/driver.py +273 -0
- sqlspec/adapters/cockroach_psycopg/events/__init__.py +6 -0
- sqlspec/adapters/cockroach_psycopg/events/store.py +34 -0
- sqlspec/adapters/cockroach_psycopg/litestar/__init__.py +3 -0
- sqlspec/adapters/cockroach_psycopg/litestar/store.py +327 -0
- sqlspec/adapters/duckdb/__init__.py +29 -0
- sqlspec/adapters/duckdb/_typing.py +104 -0
- sqlspec/adapters/duckdb/adk/__init__.py +14 -0
- sqlspec/adapters/duckdb/adk/store.py +935 -0
- sqlspec/adapters/duckdb/config.py +386 -0
- sqlspec/adapters/duckdb/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/duckdb/core.py +332 -0
- sqlspec/adapters/duckdb/data_dictionary.py +140 -0
- sqlspec/adapters/duckdb/driver.py +426 -0
- sqlspec/adapters/duckdb/events/__init__.py +5 -0
- sqlspec/adapters/duckdb/events/store.py +57 -0
- sqlspec/adapters/duckdb/litestar/__init__.py +5 -0
- sqlspec/adapters/duckdb/litestar/store.py +330 -0
- sqlspec/adapters/duckdb/pool.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/duckdb/pool.py +350 -0
- sqlspec/adapters/duckdb/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/duckdb/type_converter.py +118 -0
- sqlspec/adapters/mysqlconnector/__init__.py +39 -0
- sqlspec/adapters/mysqlconnector/_typing.py +186 -0
- sqlspec/adapters/mysqlconnector/adk/__init__.py +15 -0
- sqlspec/adapters/mysqlconnector/adk/store.py +1183 -0
- sqlspec/adapters/mysqlconnector/config.py +421 -0
- sqlspec/adapters/mysqlconnector/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/mysqlconnector/core.py +472 -0
- sqlspec/adapters/mysqlconnector/data_dictionary.py +230 -0
- sqlspec/adapters/mysqlconnector/driver.py +516 -0
- sqlspec/adapters/mysqlconnector/events/__init__.py +8 -0
- sqlspec/adapters/mysqlconnector/events/store.py +98 -0
- sqlspec/adapters/mysqlconnector/litestar/__init__.py +5 -0
- sqlspec/adapters/mysqlconnector/litestar/store.py +426 -0
- sqlspec/adapters/oracledb/__init__.py +39 -0
- sqlspec/adapters/oracledb/_json_handlers.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/_json_handlers.py +196 -0
- sqlspec/adapters/oracledb/_param_types.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/_param_types.py +46 -0
- sqlspec/adapters/oracledb/_typing.py +258 -0
- sqlspec/adapters/oracledb/_uuid_handlers.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/_uuid_handlers.py +163 -0
- sqlspec/adapters/oracledb/_vector_handlers.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/_vector_handlers.py +228 -0
- sqlspec/adapters/oracledb/adk/__init__.py +21 -0
- sqlspec/adapters/oracledb/adk/store.py +2453 -0
- sqlspec/adapters/oracledb/config.py +575 -0
- sqlspec/adapters/oracledb/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/core.py +820 -0
- sqlspec/adapters/oracledb/data_dictionary.py +404 -0
- sqlspec/adapters/oracledb/driver.py +1277 -0
- sqlspec/adapters/oracledb/events/__init__.py +16 -0
- sqlspec/adapters/oracledb/events/_hub.py +345 -0
- sqlspec/adapters/oracledb/events/backend.py +300 -0
- sqlspec/adapters/oracledb/events/store.py +420 -0
- sqlspec/adapters/oracledb/litestar/__init__.py +5 -0
- sqlspec/adapters/oracledb/litestar/store.py +781 -0
- sqlspec/adapters/oracledb/migrations.py +539 -0
- sqlspec/adapters/oracledb/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/type_converter.py +211 -0
- sqlspec/adapters/psqlpy/__init__.py +18 -0
- sqlspec/adapters/psqlpy/_typing.py +121 -0
- sqlspec/adapters/psqlpy/adk/__init__.py +5 -0
- sqlspec/adapters/psqlpy/adk/store.py +591 -0
- sqlspec/adapters/psqlpy/config.py +376 -0
- sqlspec/adapters/psqlpy/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/psqlpy/core.py +694 -0
- sqlspec/adapters/psqlpy/data_dictionary.py +121 -0
- sqlspec/adapters/psqlpy/driver.py +411 -0
- sqlspec/adapters/psqlpy/events/__init__.py +6 -0
- sqlspec/adapters/psqlpy/events/_hub.py +204 -0
- sqlspec/adapters/psqlpy/events/backend.py +210 -0
- sqlspec/adapters/psqlpy/events/store.py +20 -0
- sqlspec/adapters/psqlpy/litestar/__init__.py +5 -0
- sqlspec/adapters/psqlpy/litestar/store.py +270 -0
- sqlspec/adapters/psqlpy/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/psqlpy/type_converter.py +113 -0
- sqlspec/adapters/psycopg/__init__.py +38 -0
- sqlspec/adapters/psycopg/_typing.py +218 -0
- sqlspec/adapters/psycopg/adk/__init__.py +10 -0
- sqlspec/adapters/psycopg/adk/store.py +1106 -0
- sqlspec/adapters/psycopg/config.py +695 -0
- sqlspec/adapters/psycopg/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/psycopg/core.py +520 -0
- sqlspec/adapters/psycopg/data_dictionary.py +278 -0
- sqlspec/adapters/psycopg/driver.py +1033 -0
- sqlspec/adapters/psycopg/events/__init__.py +20 -0
- sqlspec/adapters/psycopg/events/_hub.py +388 -0
- sqlspec/adapters/psycopg/events/backend.py +398 -0
- sqlspec/adapters/psycopg/events/store.py +42 -0
- sqlspec/adapters/psycopg/litestar/__init__.py +5 -0
- sqlspec/adapters/psycopg/litestar/store.py +554 -0
- sqlspec/adapters/psycopg/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/psycopg/type_converter.py +93 -0
- sqlspec/adapters/pymysql/__init__.py +21 -0
- sqlspec/adapters/pymysql/_typing.py +92 -0
- sqlspec/adapters/pymysql/adk/__init__.py +5 -0
- sqlspec/adapters/pymysql/adk/store.py +657 -0
- sqlspec/adapters/pymysql/config.py +176 -0
- sqlspec/adapters/pymysql/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/pymysql/core.py +469 -0
- sqlspec/adapters/pymysql/data_dictionary.py +120 -0
- sqlspec/adapters/pymysql/driver.py +271 -0
- sqlspec/adapters/pymysql/events/__init__.py +5 -0
- sqlspec/adapters/pymysql/events/store.py +50 -0
- sqlspec/adapters/pymysql/litestar/__init__.py +5 -0
- sqlspec/adapters/pymysql/litestar/store.py +232 -0
- sqlspec/adapters/pymysql/pool.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/pymysql/pool.py +184 -0
- sqlspec/adapters/spanner/__init__.py +33 -0
- sqlspec/adapters/spanner/_typing.py +102 -0
- sqlspec/adapters/spanner/adk/__init__.py +5 -0
- sqlspec/adapters/spanner/adk/store.py +758 -0
- sqlspec/adapters/spanner/config.py +355 -0
- sqlspec/adapters/spanner/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/spanner/core.py +263 -0
- sqlspec/adapters/spanner/data_dictionary.py +120 -0
- sqlspec/adapters/spanner/driver.py +407 -0
- sqlspec/adapters/spanner/events/__init__.py +5 -0
- sqlspec/adapters/spanner/events/store.py +187 -0
- sqlspec/adapters/spanner/litestar/__init__.py +5 -0
- sqlspec/adapters/spanner/litestar/store.py +291 -0
- sqlspec/adapters/spanner/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/spanner/type_converter.py +342 -0
- sqlspec/adapters/sqlite/__init__.py +19 -0
- sqlspec/adapters/sqlite/_typing.py +123 -0
- sqlspec/adapters/sqlite/adk/__init__.py +5 -0
- sqlspec/adapters/sqlite/adk/store.py +992 -0
- sqlspec/adapters/sqlite/config.py +240 -0
- sqlspec/adapters/sqlite/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/sqlite/core.py +357 -0
- sqlspec/adapters/sqlite/data_dictionary.py +198 -0
- sqlspec/adapters/sqlite/driver.py +527 -0
- sqlspec/adapters/sqlite/events/__init__.py +5 -0
- sqlspec/adapters/sqlite/events/store.py +20 -0
- sqlspec/adapters/sqlite/litestar/__init__.py +5 -0
- sqlspec/adapters/sqlite/litestar/store.py +316 -0
- sqlspec/adapters/sqlite/pool.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/sqlite/pool.py +237 -0
- sqlspec/adapters/sqlite/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/sqlite/type_converter.py +114 -0
- sqlspec/base.py +832 -0
- sqlspec/builder/__init__.py +181 -0
- sqlspec/builder/_base.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_base.py +1071 -0
- sqlspec/builder/_column.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_column.py +521 -0
- sqlspec/builder/_ddl.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_ddl.py +1691 -0
- sqlspec/builder/_delete.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_delete.py +95 -0
- sqlspec/builder/_dml.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_dml.py +386 -0
- sqlspec/builder/_explain.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_explain.py +579 -0
- sqlspec/builder/_expression_wrappers.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_expression_wrappers.py +46 -0
- sqlspec/builder/_factory.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_factory.py +1884 -0
- sqlspec/builder/_insert.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_insert.py +405 -0
- sqlspec/builder/_join.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_join.py +489 -0
- sqlspec/builder/_merge.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_merge.py +823 -0
- sqlspec/builder/_parsing_utils.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_parsing_utils.py +295 -0
- sqlspec/builder/_select.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_select.py +1666 -0
- sqlspec/builder/_temporal.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_temporal.py +167 -0
- sqlspec/builder/_update.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_update.py +173 -0
- sqlspec/builder/_vector_distance.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_vector_distance.py +330 -0
- sqlspec/cli.py +1095 -0
- sqlspec/config.py +2383 -0
- sqlspec/core/__init__.py +372 -0
- sqlspec/core/_correlation.cp314-win_amd64.pyd +0 -0
- sqlspec/core/_correlation.py +176 -0
- sqlspec/core/_pagination.py +42 -0
- sqlspec/core/_pool.cp314-win_amd64.pyd +0 -0
- sqlspec/core/_pool.py +76 -0
- sqlspec/core/cache.cp314-win_amd64.pyd +0 -0
- sqlspec/core/cache.py +1085 -0
- sqlspec/core/compiler.cp314-win_amd64.pyd +0 -0
- sqlspec/core/compiler.py +1090 -0
- sqlspec/core/config_runtime.cp314-win_amd64.pyd +0 -0
- sqlspec/core/config_runtime.py +174 -0
- sqlspec/core/explain.cp314-win_amd64.pyd +0 -0
- sqlspec/core/explain.py +275 -0
- sqlspec/core/filters.cp314-win_amd64.pyd +0 -0
- sqlspec/core/filters.py +969 -0
- sqlspec/core/hashing.cp314-win_amd64.pyd +0 -0
- sqlspec/core/hashing.py +266 -0
- sqlspec/core/metrics.cp314-win_amd64.pyd +0 -0
- sqlspec/core/metrics.py +83 -0
- sqlspec/core/parameters/__init__.py +72 -0
- sqlspec/core/parameters/_alignment.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_alignment.py +283 -0
- sqlspec/core/parameters/_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_converter.py +554 -0
- sqlspec/core/parameters/_processor.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_processor.py +1182 -0
- sqlspec/core/parameters/_registry.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_registry.py +206 -0
- sqlspec/core/parameters/_transformers.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_transformers.py +324 -0
- sqlspec/core/parameters/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_types.py +536 -0
- sqlspec/core/parameters/_validator.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_validator.py +171 -0
- sqlspec/core/pipeline.cp314-win_amd64.pyd +0 -0
- sqlspec/core/pipeline.py +333 -0
- sqlspec/core/query_modifiers.cp314-win_amd64.pyd +0 -0
- sqlspec/core/query_modifiers.py +508 -0
- sqlspec/core/result/__init__.py +25 -0
- sqlspec/core/result/_base.cp314-win_amd64.pyd +0 -0
- sqlspec/core/result/_base.py +1232 -0
- sqlspec/core/result/_io.cp314-win_amd64.pyd +0 -0
- sqlspec/core/result/_io.py +28 -0
- sqlspec/core/splitter.cp314-win_amd64.pyd +0 -0
- sqlspec/core/splitter.py +1021 -0
- sqlspec/core/sqlcommenter.cp314-win_amd64.pyd +0 -0
- sqlspec/core/sqlcommenter.py +249 -0
- sqlspec/core/stack.cp314-win_amd64.pyd +0 -0
- sqlspec/core/stack.py +163 -0
- sqlspec/core/statement.cp314-win_amd64.pyd +0 -0
- sqlspec/core/statement.py +1865 -0
- sqlspec/core/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/core/type_converter.py +340 -0
- sqlspec/data_dictionary/__init__.py +22 -0
- sqlspec/data_dictionary/_loader.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/_loader.py +138 -0
- sqlspec/data_dictionary/_registry.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/_registry.py +74 -0
- sqlspec/data_dictionary/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/_types.py +121 -0
- sqlspec/data_dictionary/dialects/__init__.py +21 -0
- sqlspec/data_dictionary/dialects/bigquery.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/bigquery.py +81 -0
- sqlspec/data_dictionary/dialects/cockroachdb.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/cockroachdb.py +54 -0
- sqlspec/data_dictionary/dialects/duckdb.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/duckdb.py +47 -0
- sqlspec/data_dictionary/dialects/mysql.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/mysql.py +53 -0
- sqlspec/data_dictionary/dialects/oracle.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/oracle.py +197 -0
- sqlspec/data_dictionary/dialects/postgres.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/postgres.py +69 -0
- sqlspec/data_dictionary/dialects/spanner.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/spanner.py +37 -0
- sqlspec/data_dictionary/dialects/sqlite.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/sqlite.py +59 -0
- sqlspec/data_dictionary/sql/.gitkeep +0 -0
- sqlspec/data_dictionary/sql/bigquery/columns.sql +23 -0
- sqlspec/data_dictionary/sql/bigquery/foreign_keys.sql +34 -0
- sqlspec/data_dictionary/sql/bigquery/indexes.sql +19 -0
- sqlspec/data_dictionary/sql/bigquery/tables.sql +33 -0
- sqlspec/data_dictionary/sql/bigquery/version.sql +3 -0
- sqlspec/data_dictionary/sql/cockroachdb/columns.sql +34 -0
- sqlspec/data_dictionary/sql/cockroachdb/foreign_keys.sql +40 -0
- sqlspec/data_dictionary/sql/cockroachdb/indexes.sql +32 -0
- sqlspec/data_dictionary/sql/cockroachdb/tables.sql +44 -0
- sqlspec/data_dictionary/sql/cockroachdb/version.sql +3 -0
- sqlspec/data_dictionary/sql/duckdb/columns.sql +23 -0
- sqlspec/data_dictionary/sql/duckdb/foreign_keys.sql +36 -0
- sqlspec/data_dictionary/sql/duckdb/indexes.sql +19 -0
- sqlspec/data_dictionary/sql/duckdb/tables.sql +38 -0
- sqlspec/data_dictionary/sql/duckdb/version.sql +3 -0
- sqlspec/data_dictionary/sql/mysql/columns.sql +23 -0
- sqlspec/data_dictionary/sql/mysql/foreign_keys.sql +28 -0
- sqlspec/data_dictionary/sql/mysql/indexes.sql +26 -0
- sqlspec/data_dictionary/sql/mysql/tables.sql +33 -0
- sqlspec/data_dictionary/sql/mysql/version.sql +3 -0
- sqlspec/data_dictionary/sql/oracle/columns.sql +23 -0
- sqlspec/data_dictionary/sql/oracle/foreign_keys.sql +48 -0
- sqlspec/data_dictionary/sql/oracle/indexes.sql +44 -0
- sqlspec/data_dictionary/sql/oracle/tables.sql +25 -0
- sqlspec/data_dictionary/sql/oracle/version.sql +20 -0
- sqlspec/data_dictionary/sql/postgres/columns.sql +34 -0
- sqlspec/data_dictionary/sql/postgres/foreign_keys.sql +40 -0
- sqlspec/data_dictionary/sql/postgres/indexes.sql +56 -0
- sqlspec/data_dictionary/sql/postgres/tables.sql +44 -0
- sqlspec/data_dictionary/sql/postgres/version.sql +3 -0
- sqlspec/data_dictionary/sql/spanner/columns.sql +23 -0
- sqlspec/data_dictionary/sql/spanner/foreign_keys.sql +70 -0
- sqlspec/data_dictionary/sql/spanner/indexes.sql +30 -0
- sqlspec/data_dictionary/sql/spanner/tables.sql +9 -0
- sqlspec/data_dictionary/sql/spanner/version.sql +3 -0
- sqlspec/data_dictionary/sql/sqlite/columns.sql +23 -0
- sqlspec/data_dictionary/sql/sqlite/foreign_keys.sql +22 -0
- sqlspec/data_dictionary/sql/sqlite/indexes.sql +7 -0
- sqlspec/data_dictionary/sql/sqlite/tables.sql +28 -0
- sqlspec/data_dictionary/sql/sqlite/version.sql +3 -0
- sqlspec/dialects/__init__.py +22 -0
- sqlspec/dialects/_compat.cp314-win_amd64.pyd +0 -0
- sqlspec/dialects/_compat.py +14 -0
- sqlspec/dialects/postgres/__init__.py +9 -0
- sqlspec/dialects/postgres/_generators.cp314-win_amd64.pyd +0 -0
- sqlspec/dialects/postgres/_generators.py +57 -0
- sqlspec/dialects/postgres/_operators.cp314-win_amd64.pyd +0 -0
- sqlspec/dialects/postgres/_operators.py +81 -0
- sqlspec/dialects/postgres/_paradedb.py +50 -0
- sqlspec/dialects/postgres/_pgvector.py +36 -0
- sqlspec/dialects/spanner/__init__.py +6 -0
- sqlspec/dialects/spanner/_generators.cp314-win_amd64.pyd +0 -0
- sqlspec/dialects/spanner/_generators.py +206 -0
- sqlspec/dialects/spanner/_spangres.py +77 -0
- sqlspec/dialects/spanner/_spanner.py +179 -0
- sqlspec/driver/__init__.py +49 -0
- sqlspec/driver/_async.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_async.py +1830 -0
- sqlspec/driver/_common.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_common.py +2292 -0
- sqlspec/driver/_exception_handler.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_exception_handler.py +108 -0
- sqlspec/driver/_query_cache.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_query_cache.py +96 -0
- sqlspec/driver/_sql_helpers.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_sql_helpers.py +139 -0
- sqlspec/driver/_storage_helpers.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_storage_helpers.py +153 -0
- sqlspec/driver/_sync.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_sync.py +1817 -0
- sqlspec/exceptions.cp314-win_amd64.pyd +0 -0
- sqlspec/exceptions.py +480 -0
- sqlspec/extensions/__init__.py +0 -0
- sqlspec/extensions/adk/__init__.py +84 -0
- sqlspec/extensions/adk/_config_utils.py +199 -0
- sqlspec/extensions/adk/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/adk/_types.py +41 -0
- sqlspec/extensions/adk/artifact/__init__.py +57 -0
- sqlspec/extensions/adk/artifact/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/adk/artifact/_types.py +32 -0
- sqlspec/extensions/adk/artifact/service.py +508 -0
- sqlspec/extensions/adk/artifact/store.py +361 -0
- sqlspec/extensions/adk/converters.py +212 -0
- sqlspec/extensions/adk/memory/__init__.py +69 -0
- sqlspec/extensions/adk/memory/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/adk/memory/_types.py +30 -0
- sqlspec/extensions/adk/memory/converters.py +225 -0
- sqlspec/extensions/adk/memory/service.py +316 -0
- sqlspec/extensions/adk/memory/store.py +525 -0
- sqlspec/extensions/adk/migrations/0001_create_adk_tables.py +184 -0
- sqlspec/extensions/adk/migrations/__init__.py +0 -0
- sqlspec/extensions/adk/service.py +279 -0
- sqlspec/extensions/adk/store.py +590 -0
- sqlspec/extensions/events/__init__.py +51 -0
- sqlspec/extensions/events/_channel.py +703 -0
- sqlspec/extensions/events/_hints.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/events/_hints.py +45 -0
- sqlspec/extensions/events/_models.py +23 -0
- sqlspec/extensions/events/_payload.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/events/_payload.py +69 -0
- sqlspec/extensions/events/_protocols.py +134 -0
- sqlspec/extensions/events/_queue.py +462 -0
- sqlspec/extensions/events/_store.py +209 -0
- sqlspec/extensions/events/migrations/0001_create_event_queue.py +59 -0
- sqlspec/extensions/events/migrations/__init__.py +3 -0
- sqlspec/extensions/fastapi/__init__.py +22 -0
- sqlspec/extensions/fastapi/extension.py +391 -0
- sqlspec/extensions/fastapi/providers.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/fastapi/providers.py +712 -0
- sqlspec/extensions/flask/__init__.py +38 -0
- sqlspec/extensions/flask/_state.py +87 -0
- sqlspec/extensions/flask/_utils.py +71 -0
- sqlspec/extensions/flask/extension.py +539 -0
- sqlspec/extensions/litestar/__init__.py +31 -0
- sqlspec/extensions/litestar/_utils.py +52 -0
- sqlspec/extensions/litestar/channels.py +165 -0
- sqlspec/extensions/litestar/cli.py +102 -0
- sqlspec/extensions/litestar/config.py +90 -0
- sqlspec/extensions/litestar/handlers.py +316 -0
- sqlspec/extensions/litestar/migrations/0001_create_session_table.py +137 -0
- sqlspec/extensions/litestar/migrations/__init__.py +3 -0
- sqlspec/extensions/litestar/plugin.py +1066 -0
- sqlspec/extensions/litestar/providers.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/litestar/providers.py +784 -0
- sqlspec/extensions/litestar/store.py +298 -0
- sqlspec/extensions/otel/__init__.py +58 -0
- sqlspec/extensions/prometheus/__init__.py +113 -0
- sqlspec/extensions/sanic/__init__.py +19 -0
- sqlspec/extensions/sanic/_state.py +43 -0
- sqlspec/extensions/sanic/_utils.py +127 -0
- sqlspec/extensions/sanic/extension.py +647 -0
- sqlspec/extensions/starlette/__init__.py +22 -0
- sqlspec/extensions/starlette/_state.py +42 -0
- sqlspec/extensions/starlette/_utils.py +96 -0
- sqlspec/extensions/starlette/extension.py +374 -0
- sqlspec/extensions/starlette/middleware.py +281 -0
- sqlspec/loader.cp314-win_amd64.pyd +0 -0
- sqlspec/loader.py +727 -0
- sqlspec/migrations/__init__.py +39 -0
- sqlspec/migrations/base.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/base.py +862 -0
- sqlspec/migrations/commands.py +2151 -0
- sqlspec/migrations/context.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/context.py +157 -0
- sqlspec/migrations/fix.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/fix.py +204 -0
- sqlspec/migrations/loaders.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/loaders.py +443 -0
- sqlspec/migrations/runner.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/runner.py +1195 -0
- sqlspec/migrations/squash.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/squash.py +490 -0
- sqlspec/migrations/templates.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/templates.py +234 -0
- sqlspec/migrations/tracker.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/tracker.py +792 -0
- sqlspec/migrations/utils.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/utils.py +256 -0
- sqlspec/migrations/validation.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/validation.py +359 -0
- sqlspec/migrations/version.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/version.py +446 -0
- sqlspec/observability/__init__.py +57 -0
- sqlspec/observability/_common.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_common.py +77 -0
- sqlspec/observability/_config.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_config.py +364 -0
- sqlspec/observability/_diagnostics.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_diagnostics.py +74 -0
- sqlspec/observability/_dispatcher.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_dispatcher.py +200 -0
- sqlspec/observability/_formatters/__init__.py +13 -0
- sqlspec/observability/_formatters/_aws.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_formatters/_aws.py +102 -0
- sqlspec/observability/_formatters/_azure.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_formatters/_azure.py +96 -0
- sqlspec/observability/_formatters/_base.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_formatters/_base.py +57 -0
- sqlspec/observability/_formatters/_gcp.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_formatters/_gcp.py +131 -0
- sqlspec/observability/_formatting.py +58 -0
- sqlspec/observability/_observer.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_observer.py +361 -0
- sqlspec/observability/_runtime.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_runtime.py +461 -0
- sqlspec/observability/_sampling.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_sampling.py +188 -0
- sqlspec/observability/_spans.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_spans.py +161 -0
- sqlspec/protocols.py +955 -0
- sqlspec/py.typed +0 -0
- sqlspec/service.py +433 -0
- sqlspec/storage/__init__.py +48 -0
- sqlspec/storage/_arrow_payload.py +68 -0
- sqlspec/storage/_paths.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/_paths.py +58 -0
- sqlspec/storage/_utils.py +46 -0
- sqlspec/storage/backends/__init__.py +1 -0
- sqlspec/storage/backends/base.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/backends/base.py +374 -0
- sqlspec/storage/backends/fsspec.py +574 -0
- sqlspec/storage/backends/local.py +468 -0
- sqlspec/storage/backends/obstore.py +956 -0
- sqlspec/storage/errors.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/errors.py +102 -0
- sqlspec/storage/pipeline.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/pipeline.py +628 -0
- sqlspec/storage/registry.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/registry.py +329 -0
- sqlspec/typing.py +405 -0
- sqlspec/utils/__init__.py +7 -0
- sqlspec/utils/arrow_helpers.py +384 -0
- sqlspec/utils/config_tools.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/config_tools.py +314 -0
- sqlspec/utils/correlation.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/correlation.py +134 -0
- sqlspec/utils/deprecation.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/deprecation.py +157 -0
- sqlspec/utils/dispatch.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/dispatch.py +101 -0
- sqlspec/utils/fixtures.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/fixtures.py +260 -0
- sqlspec/utils/logging.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/logging.py +251 -0
- sqlspec/utils/module_loader.py +306 -0
- sqlspec/utils/portal.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/portal.py +377 -0
- sqlspec/utils/schema.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/schema.py +1040 -0
- sqlspec/utils/serializers/__init__.py +30 -0
- sqlspec/utils/serializers/_json.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/serializers/_json.py +415 -0
- sqlspec/utils/serializers/_numpy.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/serializers/_numpy.py +65 -0
- sqlspec/utils/serializers/_schema.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/serializers/_schema.py +285 -0
- sqlspec/utils/singleton.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/singleton.py +41 -0
- sqlspec/utils/sync_tools.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/sync_tools.py +316 -0
- sqlspec/utils/text.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/text.py +109 -0
- sqlspec/utils/type_converters.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/type_converters.py +216 -0
- sqlspec/utils/type_guards.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/type_guards.py +1508 -0
- sqlspec/utils/uuids.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/uuids.py +241 -0
- sqlspec-0.47.0.dist-info/METADATA +202 -0
- sqlspec-0.47.0.dist-info/RECORD +621 -0
- sqlspec-0.47.0.dist-info/WHEEL +4 -0
- sqlspec-0.47.0.dist-info/entry_points.txt +6 -0
- sqlspec-0.47.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,527 @@
|
|
|
1
|
+
"""SQLite driver implementation."""
|
|
2
|
+
|
|
3
|
+
import sqlite3
|
|
4
|
+
from typing import TYPE_CHECKING, Any, cast
|
|
5
|
+
|
|
6
|
+
from sqlspec.adapters.sqlite._typing import SqliteCursor, SqliteSessionContext
|
|
7
|
+
from sqlspec.adapters.sqlite.core import (
|
|
8
|
+
build_insert_statement,
|
|
9
|
+
collect_rows,
|
|
10
|
+
create_mapped_exception,
|
|
11
|
+
default_statement_config,
|
|
12
|
+
driver_profile,
|
|
13
|
+
format_identifier,
|
|
14
|
+
normalize_execute_many_parameters,
|
|
15
|
+
normalize_execute_parameters,
|
|
16
|
+
resolve_rowcount,
|
|
17
|
+
)
|
|
18
|
+
from sqlspec.adapters.sqlite.data_dictionary import SqliteDataDictionary
|
|
19
|
+
from sqlspec.core import ArrowResult, ParameterStyle, TypedParameter, get_cache_config, register_driver_profile
|
|
20
|
+
from sqlspec.core.result import DMLResult
|
|
21
|
+
from sqlspec.driver import BaseSyncExceptionHandler, SyncDriverAdapterBase
|
|
22
|
+
from sqlspec.exceptions import SQLSpecError
|
|
23
|
+
|
|
24
|
+
if TYPE_CHECKING:
|
|
25
|
+
from collections.abc import Sequence
|
|
26
|
+
|
|
27
|
+
from sqlspec.adapters.sqlite._typing import SqliteConnection
|
|
28
|
+
from sqlspec.builder import QueryBuilder
|
|
29
|
+
from sqlspec.core import SQL, SQLResult, Statement, StatementConfig, StatementFilter
|
|
30
|
+
from sqlspec.core.compiler import OperationType
|
|
31
|
+
from sqlspec.driver import ExecutionResult
|
|
32
|
+
from sqlspec.driver._query_cache import CachedQuery
|
|
33
|
+
from sqlspec.storage import StorageBridgeJob, StorageDestination, StorageFormat, StorageTelemetry
|
|
34
|
+
from sqlspec.typing import StatementParameters
|
|
35
|
+
|
|
36
|
+
__all__ = ("SqliteCursor", "SqliteDriver", "SqliteExceptionHandler", "SqliteSessionContext")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class SqliteExceptionHandler(BaseSyncExceptionHandler):
|
|
40
|
+
"""Context manager for handling SQLite database exceptions.
|
|
41
|
+
|
|
42
|
+
Maps SQLite extended result codes to specific SQLSpec exceptions
|
|
43
|
+
for better error handling in application code.
|
|
44
|
+
|
|
45
|
+
Uses deferred exception pattern for mypyc compatibility: exceptions
|
|
46
|
+
are stored in pending_exception rather than raised from __exit__
|
|
47
|
+
to avoid ABI boundary violations with compiled code.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def _handle_exception(self, exc_type: "type[BaseException] | None", exc_val: "BaseException") -> bool:
|
|
51
|
+
if exc_type is None:
|
|
52
|
+
return False
|
|
53
|
+
if issubclass(exc_type, sqlite3.Error):
|
|
54
|
+
self.pending_exception = create_mapped_exception(exc_val)
|
|
55
|
+
return True
|
|
56
|
+
return False
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class SqliteDriver(SyncDriverAdapterBase):
|
|
60
|
+
"""SQLite driver implementation.
|
|
61
|
+
|
|
62
|
+
Provides SQL statement execution, transaction management, and result handling
|
|
63
|
+
for SQLite databases using the standard sqlite3 module.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
__slots__ = ("_data_dictionary",)
|
|
67
|
+
dialect = "sqlite"
|
|
68
|
+
|
|
69
|
+
def __init__(
|
|
70
|
+
self,
|
|
71
|
+
connection: "SqliteConnection",
|
|
72
|
+
statement_config: "StatementConfig | None" = None,
|
|
73
|
+
driver_features: "dict[str, Any] | None" = None,
|
|
74
|
+
) -> None:
|
|
75
|
+
"""Initialize SQLite driver.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
connection: SQLite database connection
|
|
79
|
+
statement_config: Statement configuration settings
|
|
80
|
+
driver_features: Driver-specific feature flags
|
|
81
|
+
"""
|
|
82
|
+
if statement_config is None:
|
|
83
|
+
statement_config = default_statement_config.replace(
|
|
84
|
+
enable_caching=get_cache_config().compiled_cache_enabled
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
super().__init__(connection=connection, statement_config=statement_config, driver_features=driver_features)
|
|
88
|
+
self._data_dictionary: SqliteDataDictionary | None = None
|
|
89
|
+
|
|
90
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
91
|
+
# CORE DISPATCH METHODS
|
|
92
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
93
|
+
|
|
94
|
+
def dispatch_execute(self, cursor: Any, statement: "SQL") -> "ExecutionResult":
|
|
95
|
+
"""Execute single SQL statement.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
cursor: SQLite cursor object
|
|
99
|
+
statement: SQL statement to execute
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
ExecutionResult with statement execution details
|
|
103
|
+
"""
|
|
104
|
+
sql, prepared_parameters = self._get_compiled_sql(statement, self.statement_config)
|
|
105
|
+
cursor.execute(sql, normalize_execute_parameters(prepared_parameters))
|
|
106
|
+
|
|
107
|
+
if statement.returns_rows():
|
|
108
|
+
fetched_data = cursor.fetchall()
|
|
109
|
+
data, column_names, row_count = collect_rows(fetched_data, cursor.description)
|
|
110
|
+
|
|
111
|
+
return self.create_execution_result(
|
|
112
|
+
cursor,
|
|
113
|
+
selected_data=data,
|
|
114
|
+
column_names=column_names,
|
|
115
|
+
data_row_count=row_count,
|
|
116
|
+
is_select_result=True,
|
|
117
|
+
row_format="tuple",
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
affected_rows = resolve_rowcount(cursor)
|
|
121
|
+
return self.create_execution_result(cursor, rowcount_override=affected_rows)
|
|
122
|
+
|
|
123
|
+
def dispatch_execute_many(self, cursor: Any, statement: "SQL") -> "ExecutionResult":
|
|
124
|
+
"""Execute SQL with multiple parameter sets.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
cursor: SQLite cursor object
|
|
128
|
+
statement: SQL statement with multiple parameter sets
|
|
129
|
+
|
|
130
|
+
Returns:
|
|
131
|
+
ExecutionResult with batch execution details
|
|
132
|
+
"""
|
|
133
|
+
sql, prepared_parameters = self._get_compiled_sql(statement, self.statement_config)
|
|
134
|
+
cursor.executemany(sql, normalize_execute_many_parameters(prepared_parameters))
|
|
135
|
+
affected_rows = resolve_rowcount(cursor)
|
|
136
|
+
return self.create_execution_result(cursor, rowcount_override=affected_rows, is_many_result=True)
|
|
137
|
+
|
|
138
|
+
def dispatch_execute_script(self, cursor: Any, statement: "SQL") -> "ExecutionResult":
|
|
139
|
+
"""Execute SQL script with statement splitting and parameter handling.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
cursor: SQLite cursor object
|
|
143
|
+
statement: SQL statement containing multiple statements
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
ExecutionResult with script execution details
|
|
147
|
+
"""
|
|
148
|
+
sql, prepared_parameters = self._get_compiled_sql(statement, self.statement_config)
|
|
149
|
+
statements = self.split_script_statements(sql, statement.statement_config, strip_trailing_semicolon=True)
|
|
150
|
+
|
|
151
|
+
successful_count = 0
|
|
152
|
+
last_cursor = cursor
|
|
153
|
+
|
|
154
|
+
for stmt in statements:
|
|
155
|
+
cursor.execute(stmt, normalize_execute_parameters(prepared_parameters))
|
|
156
|
+
successful_count += 1
|
|
157
|
+
|
|
158
|
+
return self.create_execution_result(
|
|
159
|
+
last_cursor, statement_count=len(statements), successful_statements=successful_count, is_script_result=True
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
def execute_many(
|
|
163
|
+
self,
|
|
164
|
+
statement: "SQL | Statement | QueryBuilder",
|
|
165
|
+
/,
|
|
166
|
+
parameters: "Sequence[StatementParameters]",
|
|
167
|
+
*filters: "StatementParameters | StatementFilter",
|
|
168
|
+
statement_config: "StatementConfig | None" = None,
|
|
169
|
+
**kwargs: Any,
|
|
170
|
+
) -> "SQLResult":
|
|
171
|
+
"""Execute many with a SQLite thin path for simple qmark batches."""
|
|
172
|
+
config = statement_config or self.statement_config
|
|
173
|
+
if (
|
|
174
|
+
isinstance(statement, str)
|
|
175
|
+
and not filters
|
|
176
|
+
and not kwargs
|
|
177
|
+
and config is self.statement_config
|
|
178
|
+
and self.observability.is_idle
|
|
179
|
+
and self._can_use_execute_many_thin_path(statement, parameters, config)
|
|
180
|
+
):
|
|
181
|
+
try:
|
|
182
|
+
cursor = self.connection.executemany(statement, parameters)
|
|
183
|
+
except sqlite3.Error as exc:
|
|
184
|
+
raise create_mapped_exception(exc) from exc
|
|
185
|
+
|
|
186
|
+
rowcount = cursor.rowcount
|
|
187
|
+
affected_rows = rowcount if isinstance(rowcount, int) and rowcount > 0 else 0
|
|
188
|
+
operation = self._resolve_dml_operation_type(statement)
|
|
189
|
+
return DMLResult(operation, affected_rows)
|
|
190
|
+
return super().execute_many(statement, parameters, *filters, statement_config=statement_config, **kwargs)
|
|
191
|
+
|
|
192
|
+
def _stmt_cache_execute_direct(
|
|
193
|
+
self, sql: str, params: "tuple[Any, ...] | list[Any]", cached: "CachedQuery"
|
|
194
|
+
) -> "SQLResult":
|
|
195
|
+
"""Execute cached query through SQLite connection.execute fast path.
|
|
196
|
+
|
|
197
|
+
This bypasses cursor context-manager overhead for repeated cached
|
|
198
|
+
statements while preserving driver exception mapping behavior.
|
|
199
|
+
"""
|
|
200
|
+
direct_statement: SQL | None = None
|
|
201
|
+
returns_rows = cached.operation_profile.returns_rows
|
|
202
|
+
try:
|
|
203
|
+
if not returns_rows:
|
|
204
|
+
try:
|
|
205
|
+
cursor = self.connection.execute(cached.compiled_sql, params)
|
|
206
|
+
except sqlite3.Error as exc:
|
|
207
|
+
raise create_mapped_exception(exc) from exc
|
|
208
|
+
|
|
209
|
+
rowcount = cursor.rowcount
|
|
210
|
+
affected_rows = rowcount if isinstance(rowcount, int) and rowcount > 0 else 0
|
|
211
|
+
return DMLResult(cached.operation_type, affected_rows)
|
|
212
|
+
|
|
213
|
+
try:
|
|
214
|
+
cursor = self.connection.execute(cached.compiled_sql, params)
|
|
215
|
+
except sqlite3.Error as exc:
|
|
216
|
+
raise create_mapped_exception(exc) from exc
|
|
217
|
+
|
|
218
|
+
if returns_rows:
|
|
219
|
+
fetched_data = cursor.fetchall()
|
|
220
|
+
column_names = cached.column_names
|
|
221
|
+
if column_names is None:
|
|
222
|
+
description = cursor.description
|
|
223
|
+
column_names = [col[0] for col in description] if description else []
|
|
224
|
+
execution_result = self.create_execution_result(
|
|
225
|
+
cursor,
|
|
226
|
+
selected_data=fetched_data,
|
|
227
|
+
column_names=column_names,
|
|
228
|
+
data_row_count=len(fetched_data),
|
|
229
|
+
is_select_result=True,
|
|
230
|
+
row_format="tuple",
|
|
231
|
+
)
|
|
232
|
+
direct_statement = self._stmt_cache_build_direct(
|
|
233
|
+
sql, params, cached, params, params_are_simple=True, compiled_sql=cached.compiled_sql
|
|
234
|
+
)
|
|
235
|
+
return self.build_statement_result(direct_statement, execution_result)
|
|
236
|
+
finally:
|
|
237
|
+
if direct_statement is not None:
|
|
238
|
+
self._release_pooled_statement(direct_statement)
|
|
239
|
+
msg = "unreachable"
|
|
240
|
+
raise AssertionError(msg) # pragma: no cover - all paths return or raise
|
|
241
|
+
|
|
242
|
+
def _can_use_execute_many_thin_path(
|
|
243
|
+
self, statement: str, parameters: "Sequence[StatementParameters]", config: "StatementConfig"
|
|
244
|
+
) -> bool:
|
|
245
|
+
if type(parameters) is not list:
|
|
246
|
+
return False
|
|
247
|
+
if not parameters:
|
|
248
|
+
return False
|
|
249
|
+
if "?" not in statement:
|
|
250
|
+
return False
|
|
251
|
+
|
|
252
|
+
parameter_config = config.parameter_config
|
|
253
|
+
if parameter_config.default_parameter_style is not ParameterStyle.QMARK:
|
|
254
|
+
return False
|
|
255
|
+
if (
|
|
256
|
+
parameter_config.default_execution_parameter_style is not None
|
|
257
|
+
and parameter_config.default_execution_parameter_style is not ParameterStyle.QMARK
|
|
258
|
+
):
|
|
259
|
+
return False
|
|
260
|
+
if parameter_config.ast_transformer is not None or parameter_config.output_transformer is not None:
|
|
261
|
+
return False
|
|
262
|
+
if parameter_config.needs_static_script_compilation:
|
|
263
|
+
return False
|
|
264
|
+
if config.output_transformer is not None or config.statement_transformers:
|
|
265
|
+
return False
|
|
266
|
+
|
|
267
|
+
return self._thin_path_parameters_are_eligible(parameters, parameter_config.type_coercion_map)
|
|
268
|
+
|
|
269
|
+
@staticmethod
|
|
270
|
+
def _thin_path_parameters_are_eligible(
|
|
271
|
+
parameters: "list[StatementParameters]", type_coercion_map: "dict[type, Any] | None"
|
|
272
|
+
) -> bool:
|
|
273
|
+
"""Validate parameter payload for the SQLite execute-many thin path."""
|
|
274
|
+
first_sequence = SqliteDriver._as_sequence_parameter_set(parameters[0])
|
|
275
|
+
if first_sequence is None:
|
|
276
|
+
return False
|
|
277
|
+
|
|
278
|
+
first_type = type(first_sequence)
|
|
279
|
+
row_len = len(first_sequence)
|
|
280
|
+
coercion_map = type_coercion_map
|
|
281
|
+
has_type_coercion = bool(coercion_map)
|
|
282
|
+
|
|
283
|
+
# Common benchmark shape: list[tuple[value]]
|
|
284
|
+
if row_len == 1:
|
|
285
|
+
if has_type_coercion and coercion_map is not None:
|
|
286
|
+
for param_set in parameters:
|
|
287
|
+
sequence = SqliteDriver._as_sequence_parameter_set(param_set)
|
|
288
|
+
if sequence is None or type(sequence) is not first_type:
|
|
289
|
+
return False
|
|
290
|
+
if len(sequence) != 1:
|
|
291
|
+
return False
|
|
292
|
+
value_type = type(sequence[0])
|
|
293
|
+
if value_type is TypedParameter or value_type in coercion_map:
|
|
294
|
+
return False
|
|
295
|
+
return True
|
|
296
|
+
|
|
297
|
+
for param_set in parameters:
|
|
298
|
+
sequence = SqliteDriver._as_sequence_parameter_set(param_set)
|
|
299
|
+
if sequence is None or type(sequence) is not first_type:
|
|
300
|
+
return False
|
|
301
|
+
if len(sequence) != 1:
|
|
302
|
+
return False
|
|
303
|
+
if type(sequence[0]) is TypedParameter:
|
|
304
|
+
return False
|
|
305
|
+
return True
|
|
306
|
+
|
|
307
|
+
if has_type_coercion and coercion_map is not None:
|
|
308
|
+
for param_set in parameters:
|
|
309
|
+
sequence = SqliteDriver._as_sequence_parameter_set(param_set)
|
|
310
|
+
if sequence is None or type(sequence) is not first_type:
|
|
311
|
+
return False
|
|
312
|
+
if len(sequence) != row_len:
|
|
313
|
+
return False
|
|
314
|
+
for value in sequence:
|
|
315
|
+
value_type = type(value)
|
|
316
|
+
if value_type is TypedParameter or value_type in coercion_map:
|
|
317
|
+
return False
|
|
318
|
+
return True
|
|
319
|
+
|
|
320
|
+
for param_set in parameters:
|
|
321
|
+
sequence = SqliteDriver._as_sequence_parameter_set(param_set)
|
|
322
|
+
if sequence is None or type(sequence) is not first_type:
|
|
323
|
+
return False
|
|
324
|
+
if len(sequence) != row_len:
|
|
325
|
+
return False
|
|
326
|
+
for value in sequence:
|
|
327
|
+
if type(value) is TypedParameter:
|
|
328
|
+
return False
|
|
329
|
+
return True
|
|
330
|
+
|
|
331
|
+
@staticmethod
|
|
332
|
+
def _as_sequence_parameter_set(param_set: "StatementParameters") -> "list[Any] | tuple[Any, ...] | None":
|
|
333
|
+
if isinstance(param_set, list):
|
|
334
|
+
return param_set
|
|
335
|
+
if isinstance(param_set, tuple):
|
|
336
|
+
return param_set
|
|
337
|
+
return None
|
|
338
|
+
|
|
339
|
+
@staticmethod
|
|
340
|
+
def _resolve_dml_operation_type(statement: str) -> "OperationType":
|
|
341
|
+
command_keyword = statement.lstrip().split(None, 1)[0].upper() if statement.strip() else "COMMAND"
|
|
342
|
+
if command_keyword == "INSERT":
|
|
343
|
+
return "INSERT"
|
|
344
|
+
if command_keyword == "UPDATE":
|
|
345
|
+
return "UPDATE"
|
|
346
|
+
if command_keyword == "DELETE":
|
|
347
|
+
return "DELETE"
|
|
348
|
+
return "COMMAND"
|
|
349
|
+
|
|
350
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
351
|
+
# TRANSACTION MANAGEMENT
|
|
352
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
353
|
+
|
|
354
|
+
def begin(self) -> None:
|
|
355
|
+
"""Begin a database transaction.
|
|
356
|
+
|
|
357
|
+
Raises:
|
|
358
|
+
SQLSpecError: If transaction cannot be started
|
|
359
|
+
"""
|
|
360
|
+
try:
|
|
361
|
+
if not self.connection.in_transaction:
|
|
362
|
+
self.connection.execute("BEGIN")
|
|
363
|
+
except sqlite3.Error as e:
|
|
364
|
+
msg = f"Failed to begin transaction: {e}"
|
|
365
|
+
raise SQLSpecError(msg) from e
|
|
366
|
+
|
|
367
|
+
def commit(self) -> None:
|
|
368
|
+
"""Commit the current transaction.
|
|
369
|
+
|
|
370
|
+
Raises:
|
|
371
|
+
SQLSpecError: If transaction cannot be committed
|
|
372
|
+
"""
|
|
373
|
+
try:
|
|
374
|
+
self.connection.commit()
|
|
375
|
+
except sqlite3.Error as e:
|
|
376
|
+
msg = f"Failed to commit transaction: {e}"
|
|
377
|
+
raise SQLSpecError(msg) from e
|
|
378
|
+
|
|
379
|
+
def rollback(self) -> None:
|
|
380
|
+
"""Rollback the current transaction.
|
|
381
|
+
|
|
382
|
+
Raises:
|
|
383
|
+
SQLSpecError: If transaction cannot be rolled back
|
|
384
|
+
"""
|
|
385
|
+
try:
|
|
386
|
+
self.connection.rollback()
|
|
387
|
+
except sqlite3.Error as e:
|
|
388
|
+
msg = f"Failed to rollback transaction: {e}"
|
|
389
|
+
raise SQLSpecError(msg) from e
|
|
390
|
+
|
|
391
|
+
def with_cursor(self, connection: "SqliteConnection") -> "SqliteCursor":
|
|
392
|
+
"""Create context manager for SQLite cursor.
|
|
393
|
+
|
|
394
|
+
Args:
|
|
395
|
+
connection: SQLite database connection
|
|
396
|
+
|
|
397
|
+
Returns:
|
|
398
|
+
Cursor context manager for safe cursor operations
|
|
399
|
+
"""
|
|
400
|
+
return SqliteCursor(connection)
|
|
401
|
+
|
|
402
|
+
def handle_database_exceptions(self) -> "SqliteExceptionHandler":
|
|
403
|
+
"""Handle database-specific exceptions and wrap them appropriately.
|
|
404
|
+
|
|
405
|
+
Returns:
|
|
406
|
+
Exception handler with deferred exception pattern for mypyc compatibility.
|
|
407
|
+
"""
|
|
408
|
+
return SqliteExceptionHandler()
|
|
409
|
+
|
|
410
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
411
|
+
# STORAGE API
|
|
412
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
413
|
+
|
|
414
|
+
def select_to_storage(
|
|
415
|
+
self,
|
|
416
|
+
statement: "SQL | str",
|
|
417
|
+
destination: "StorageDestination",
|
|
418
|
+
/,
|
|
419
|
+
*parameters: Any,
|
|
420
|
+
statement_config: "StatementConfig | None" = None,
|
|
421
|
+
partitioner: "dict[str, object] | None" = None,
|
|
422
|
+
format_hint: "StorageFormat | None" = None,
|
|
423
|
+
telemetry: "StorageTelemetry | None" = None,
|
|
424
|
+
**kwargs: Any,
|
|
425
|
+
) -> "StorageBridgeJob":
|
|
426
|
+
"""Execute a query and write Arrow-compatible output to storage (sync)."""
|
|
427
|
+
|
|
428
|
+
self._require_capability("arrow_export_enabled")
|
|
429
|
+
arrow_result = self.select_to_arrow(statement, *parameters, statement_config=statement_config, **kwargs)
|
|
430
|
+
sync_pipeline = self._storage_pipeline()
|
|
431
|
+
telemetry_payload = self._write_result_to_storage_sync(
|
|
432
|
+
arrow_result, destination, format_hint=format_hint, pipeline=sync_pipeline
|
|
433
|
+
)
|
|
434
|
+
self._attach_partition_telemetry(telemetry_payload, partitioner)
|
|
435
|
+
return self._create_storage_job(telemetry_payload, telemetry)
|
|
436
|
+
|
|
437
|
+
def load_from_arrow(
|
|
438
|
+
self,
|
|
439
|
+
table: str,
|
|
440
|
+
source: "ArrowResult | Any",
|
|
441
|
+
*,
|
|
442
|
+
partitioner: "dict[str, object] | None" = None,
|
|
443
|
+
overwrite: bool = False,
|
|
444
|
+
telemetry: "StorageTelemetry | None" = None,
|
|
445
|
+
) -> "StorageBridgeJob":
|
|
446
|
+
"""Load Arrow data into SQLite using batched inserts."""
|
|
447
|
+
|
|
448
|
+
self._require_capability("arrow_import_enabled")
|
|
449
|
+
arrow_table = self._coerce_arrow_table(source)
|
|
450
|
+
if overwrite:
|
|
451
|
+
statement = f"DELETE FROM {format_identifier(table)}"
|
|
452
|
+
try:
|
|
453
|
+
with self.with_cursor(self.connection) as cursor:
|
|
454
|
+
cursor.execute(statement)
|
|
455
|
+
except sqlite3.Error as exc:
|
|
456
|
+
raise create_mapped_exception(exc) from exc
|
|
457
|
+
|
|
458
|
+
columns, records = self._arrow_table_to_rows(arrow_table)
|
|
459
|
+
if records:
|
|
460
|
+
insert_sql = build_insert_statement(table, columns)
|
|
461
|
+
prepared_records = (
|
|
462
|
+
self.prepare_driver_parameters(records, self.statement_config, is_many=True)
|
|
463
|
+
if self._arrow_table_needs_parameter_preparation(arrow_table)
|
|
464
|
+
else records
|
|
465
|
+
)
|
|
466
|
+
try:
|
|
467
|
+
with self.with_cursor(self.connection) as cursor:
|
|
468
|
+
cursor.executemany(insert_sql, cast("Any", prepared_records))
|
|
469
|
+
except sqlite3.Error as exc:
|
|
470
|
+
raise create_mapped_exception(exc) from exc
|
|
471
|
+
|
|
472
|
+
telemetry_payload = self._build_ingest_telemetry(arrow_table)
|
|
473
|
+
telemetry_payload["destination"] = table
|
|
474
|
+
self._attach_partition_telemetry(telemetry_payload, partitioner)
|
|
475
|
+
return self._create_storage_job(telemetry_payload, telemetry)
|
|
476
|
+
|
|
477
|
+
def load_from_storage(
|
|
478
|
+
self,
|
|
479
|
+
table: str,
|
|
480
|
+
source: "StorageDestination",
|
|
481
|
+
*,
|
|
482
|
+
file_format: "StorageFormat",
|
|
483
|
+
partitioner: "dict[str, object] | None" = None,
|
|
484
|
+
overwrite: bool = False,
|
|
485
|
+
) -> "StorageBridgeJob":
|
|
486
|
+
"""Load staged artifacts from storage into SQLite."""
|
|
487
|
+
|
|
488
|
+
arrow_table, inbound = self._read_arrow_from_storage_sync(source, file_format=file_format)
|
|
489
|
+
return self.load_from_arrow(table, arrow_table, partitioner=partitioner, overwrite=overwrite, telemetry=inbound)
|
|
490
|
+
|
|
491
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
492
|
+
# UTILITY METHODS
|
|
493
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
494
|
+
|
|
495
|
+
@property
|
|
496
|
+
def data_dictionary(self) -> "SqliteDataDictionary":
|
|
497
|
+
"""Get the data dictionary for this driver.
|
|
498
|
+
|
|
499
|
+
Returns:
|
|
500
|
+
Data dictionary instance for metadata queries
|
|
501
|
+
"""
|
|
502
|
+
if self._data_dictionary is None:
|
|
503
|
+
self._data_dictionary = SqliteDataDictionary()
|
|
504
|
+
return self._data_dictionary
|
|
505
|
+
|
|
506
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
507
|
+
# PRIVATE/INTERNAL METHODS
|
|
508
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
509
|
+
|
|
510
|
+
def collect_rows(self, cursor: Any, fetched: "list[Any]") -> "tuple[list[Any], list[str], int]":
|
|
511
|
+
"""Collect SQLite rows for the direct execution path."""
|
|
512
|
+
return collect_rows(fetched, cursor.description)
|
|
513
|
+
|
|
514
|
+
def resolve_rowcount(self, cursor: Any) -> int:
|
|
515
|
+
"""Resolve rowcount from SQLite cursor for the direct execution path."""
|
|
516
|
+
return resolve_rowcount(cursor)
|
|
517
|
+
|
|
518
|
+
def _connection_in_transaction(self) -> bool:
|
|
519
|
+
"""Check if connection is in transaction.
|
|
520
|
+
|
|
521
|
+
Returns:
|
|
522
|
+
True if connection is in an active transaction.
|
|
523
|
+
"""
|
|
524
|
+
return bool(self.connection.in_transaction)
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
register_driver_profile("sqlite", driver_profile)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""SQLite event queue store."""
|
|
2
|
+
|
|
3
|
+
from sqlspec.adapters.sqlite.config import SqliteConfig
|
|
4
|
+
from sqlspec.extensions.events import BaseEventQueueStore
|
|
5
|
+
|
|
6
|
+
__all__ = ("SqliteEventQueueStore",)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SqliteEventQueueStore(BaseEventQueueStore[SqliteConfig]):
|
|
10
|
+
"""Provide SQLite-specific column types for the events queue.
|
|
11
|
+
|
|
12
|
+
SQLite stores JSON as TEXT since it lacks a native JSON column type.
|
|
13
|
+
JSON functions can still operate on TEXT columns containing valid JSON.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
__slots__ = ()
|
|
17
|
+
|
|
18
|
+
def _column_types(self) -> "tuple[str, str, str]":
|
|
19
|
+
"""Return SQLite-compatible column types for the event queue."""
|
|
20
|
+
return "TEXT", "TEXT", "TIMESTAMP"
|