sqlspec 0.36.0__cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.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.
- ac8f31065839703b4e70__mypyc.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/__init__.py +140 -0
- sqlspec/__main__.py +12 -0
- sqlspec/__metadata__.py +14 -0
- sqlspec/_serialization.py +315 -0
- sqlspec/_typing.py +700 -0
- sqlspec/adapters/__init__.py +0 -0
- sqlspec/adapters/adbc/__init__.py +5 -0
- sqlspec/adapters/adbc/_typing.py +82 -0
- sqlspec/adapters/adbc/adk/__init__.py +5 -0
- sqlspec/adapters/adbc/adk/store.py +1273 -0
- sqlspec/adapters/adbc/config.py +295 -0
- sqlspec/adapters/adbc/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/adbc/core.py +735 -0
- sqlspec/adapters/adbc/data_dictionary.py +334 -0
- sqlspec/adapters/adbc/driver.py +529 -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 +502 -0
- sqlspec/adapters/adbc/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/adbc/type_converter.py +140 -0
- sqlspec/adapters/aiosqlite/__init__.py +25 -0
- sqlspec/adapters/aiosqlite/_typing.py +82 -0
- sqlspec/adapters/aiosqlite/adk/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/adk/store.py +818 -0
- sqlspec/adapters/aiosqlite/config.py +334 -0
- sqlspec/adapters/aiosqlite/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/aiosqlite/core.py +315 -0
- sqlspec/adapters/aiosqlite/data_dictionary.py +208 -0
- sqlspec/adapters/aiosqlite/driver.py +313 -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.py +533 -0
- sqlspec/adapters/asyncmy/__init__.py +21 -0
- sqlspec/adapters/asyncmy/_typing.py +87 -0
- sqlspec/adapters/asyncmy/adk/__init__.py +5 -0
- sqlspec/adapters/asyncmy/adk/store.py +703 -0
- sqlspec/adapters/asyncmy/config.py +302 -0
- sqlspec/adapters/asyncmy/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/asyncmy/core.py +360 -0
- sqlspec/adapters/asyncmy/data_dictionary.py +124 -0
- sqlspec/adapters/asyncmy/driver.py +383 -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 +19 -0
- sqlspec/adapters/asyncpg/_typing.py +88 -0
- sqlspec/adapters/asyncpg/adk/__init__.py +5 -0
- sqlspec/adapters/asyncpg/adk/store.py +748 -0
- sqlspec/adapters/asyncpg/config.py +569 -0
- sqlspec/adapters/asyncpg/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/asyncpg/core.py +367 -0
- sqlspec/adapters/asyncpg/data_dictionary.py +162 -0
- sqlspec/adapters/asyncpg/driver.py +487 -0
- sqlspec/adapters/asyncpg/events/__init__.py +6 -0
- sqlspec/adapters/asyncpg/events/backend.py +286 -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 +14 -0
- sqlspec/adapters/bigquery/_typing.py +86 -0
- sqlspec/adapters/bigquery/adk/__init__.py +5 -0
- sqlspec/adapters/bigquery/adk/store.py +827 -0
- sqlspec/adapters/bigquery/config.py +353 -0
- sqlspec/adapters/bigquery/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/bigquery/core.py +715 -0
- sqlspec/adapters/bigquery/data_dictionary.py +128 -0
- sqlspec/adapters/bigquery/driver.py +548 -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.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/bigquery/type_converter.py +107 -0
- sqlspec/adapters/cockroach_asyncpg/__init__.py +24 -0
- sqlspec/adapters/cockroach_asyncpg/_typing.py +72 -0
- sqlspec/adapters/cockroach_asyncpg/adk/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/adk/store.py +410 -0
- sqlspec/adapters/cockroach_asyncpg/config.py +238 -0
- sqlspec/adapters/cockroach_asyncpg/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/cockroach_asyncpg/core.py +55 -0
- sqlspec/adapters/cockroach_asyncpg/data_dictionary.py +107 -0
- sqlspec/adapters/cockroach_asyncpg/driver.py +144 -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 +38 -0
- sqlspec/adapters/cockroach_psycopg/_typing.py +129 -0
- sqlspec/adapters/cockroach_psycopg/adk/__init__.py +13 -0
- sqlspec/adapters/cockroach_psycopg/adk/store.py +868 -0
- sqlspec/adapters/cockroach_psycopg/config.py +484 -0
- sqlspec/adapters/cockroach_psycopg/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/cockroach_psycopg/core.py +63 -0
- sqlspec/adapters/cockroach_psycopg/data_dictionary.py +215 -0
- sqlspec/adapters/cockroach_psycopg/driver.py +284 -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 +325 -0
- sqlspec/adapters/duckdb/__init__.py +25 -0
- sqlspec/adapters/duckdb/_typing.py +81 -0
- sqlspec/adapters/duckdb/adk/__init__.py +14 -0
- sqlspec/adapters/duckdb/adk/store.py +850 -0
- sqlspec/adapters/duckdb/config.py +463 -0
- sqlspec/adapters/duckdb/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/duckdb/core.py +257 -0
- sqlspec/adapters/duckdb/data_dictionary.py +140 -0
- sqlspec/adapters/duckdb/driver.py +430 -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.py +293 -0
- sqlspec/adapters/duckdb/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/duckdb/type_converter.py +118 -0
- sqlspec/adapters/mock/__init__.py +72 -0
- sqlspec/adapters/mock/_typing.py +147 -0
- sqlspec/adapters/mock/config.py +483 -0
- sqlspec/adapters/mock/core.py +319 -0
- sqlspec/adapters/mock/data_dictionary.py +366 -0
- sqlspec/adapters/mock/driver.py +721 -0
- sqlspec/adapters/mysqlconnector/__init__.py +36 -0
- sqlspec/adapters/mysqlconnector/_typing.py +141 -0
- sqlspec/adapters/mysqlconnector/adk/__init__.py +15 -0
- sqlspec/adapters/mysqlconnector/adk/store.py +1060 -0
- sqlspec/adapters/mysqlconnector/config.py +394 -0
- sqlspec/adapters/mysqlconnector/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/mysqlconnector/core.py +303 -0
- sqlspec/adapters/mysqlconnector/data_dictionary.py +235 -0
- sqlspec/adapters/mysqlconnector/driver.py +483 -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 +60 -0
- sqlspec/adapters/oracledb/_numpy_handlers.py +141 -0
- sqlspec/adapters/oracledb/_typing.py +182 -0
- sqlspec/adapters/oracledb/_uuid_handlers.py +166 -0
- sqlspec/adapters/oracledb/adk/__init__.py +10 -0
- sqlspec/adapters/oracledb/adk/store.py +2369 -0
- sqlspec/adapters/oracledb/config.py +550 -0
- sqlspec/adapters/oracledb/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/oracledb/core.py +543 -0
- sqlspec/adapters/oracledb/data_dictionary.py +536 -0
- sqlspec/adapters/oracledb/driver.py +1229 -0
- sqlspec/adapters/oracledb/events/__init__.py +16 -0
- sqlspec/adapters/oracledb/events/backend.py +347 -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 +535 -0
- sqlspec/adapters/oracledb/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/oracledb/type_converter.py +211 -0
- sqlspec/adapters/psqlpy/__init__.py +17 -0
- sqlspec/adapters/psqlpy/_typing.py +79 -0
- sqlspec/adapters/psqlpy/adk/__init__.py +5 -0
- sqlspec/adapters/psqlpy/adk/store.py +766 -0
- sqlspec/adapters/psqlpy/config.py +304 -0
- sqlspec/adapters/psqlpy/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/psqlpy/core.py +480 -0
- sqlspec/adapters/psqlpy/data_dictionary.py +126 -0
- sqlspec/adapters/psqlpy/driver.py +438 -0
- sqlspec/adapters/psqlpy/events/__init__.py +6 -0
- sqlspec/adapters/psqlpy/events/backend.py +310 -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.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/psqlpy/type_converter.py +113 -0
- sqlspec/adapters/psycopg/__init__.py +32 -0
- sqlspec/adapters/psycopg/_typing.py +164 -0
- sqlspec/adapters/psycopg/adk/__init__.py +10 -0
- sqlspec/adapters/psycopg/adk/store.py +1387 -0
- sqlspec/adapters/psycopg/config.py +576 -0
- sqlspec/adapters/psycopg/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/psycopg/core.py +450 -0
- sqlspec/adapters/psycopg/data_dictionary.py +289 -0
- sqlspec/adapters/psycopg/driver.py +975 -0
- sqlspec/adapters/psycopg/events/__init__.py +20 -0
- sqlspec/adapters/psycopg/events/backend.py +458 -0
- sqlspec/adapters/psycopg/events/store.py +42 -0
- sqlspec/adapters/psycopg/litestar/__init__.py +5 -0
- sqlspec/adapters/psycopg/litestar/store.py +552 -0
- sqlspec/adapters/psycopg/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/psycopg/type_converter.py +93 -0
- sqlspec/adapters/pymysql/__init__.py +21 -0
- sqlspec/adapters/pymysql/_typing.py +71 -0
- sqlspec/adapters/pymysql/adk/__init__.py +5 -0
- sqlspec/adapters/pymysql/adk/store.py +540 -0
- sqlspec/adapters/pymysql/config.py +195 -0
- sqlspec/adapters/pymysql/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/pymysql/core.py +299 -0
- sqlspec/adapters/pymysql/data_dictionary.py +122 -0
- sqlspec/adapters/pymysql/driver.py +259 -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.py +137 -0
- sqlspec/adapters/spanner/__init__.py +40 -0
- sqlspec/adapters/spanner/_typing.py +86 -0
- sqlspec/adapters/spanner/adk/__init__.py +5 -0
- sqlspec/adapters/spanner/adk/store.py +732 -0
- sqlspec/adapters/spanner/config.py +352 -0
- sqlspec/adapters/spanner/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/spanner/core.py +188 -0
- sqlspec/adapters/spanner/data_dictionary.py +120 -0
- sqlspec/adapters/spanner/dialect/__init__.py +6 -0
- sqlspec/adapters/spanner/dialect/_spangres.py +57 -0
- sqlspec/adapters/spanner/dialect/_spanner.py +130 -0
- sqlspec/adapters/spanner/driver.py +373 -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.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/spanner/type_converter.py +331 -0
- sqlspec/adapters/sqlite/__init__.py +19 -0
- sqlspec/adapters/sqlite/_typing.py +80 -0
- sqlspec/adapters/sqlite/adk/__init__.py +5 -0
- sqlspec/adapters/sqlite/adk/store.py +958 -0
- sqlspec/adapters/sqlite/config.py +280 -0
- sqlspec/adapters/sqlite/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/sqlite/core.py +312 -0
- sqlspec/adapters/sqlite/data_dictionary.py +202 -0
- sqlspec/adapters/sqlite/driver.py +359 -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.py +198 -0
- sqlspec/adapters/sqlite/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/sqlite/type_converter.py +114 -0
- sqlspec/base.py +747 -0
- sqlspec/builder/__init__.py +179 -0
- sqlspec/builder/_base.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_base.py +1022 -0
- sqlspec/builder/_column.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_column.py +521 -0
- sqlspec/builder/_ddl.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_ddl.py +1642 -0
- sqlspec/builder/_delete.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_delete.py +95 -0
- sqlspec/builder/_dml.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_dml.py +365 -0
- sqlspec/builder/_explain.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_explain.py +579 -0
- sqlspec/builder/_expression_wrappers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_expression_wrappers.py +46 -0
- sqlspec/builder/_factory.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_factory.py +1697 -0
- sqlspec/builder/_insert.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_insert.py +328 -0
- sqlspec/builder/_join.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_join.py +499 -0
- sqlspec/builder/_merge.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_merge.py +821 -0
- sqlspec/builder/_parsing_utils.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_parsing_utils.py +297 -0
- sqlspec/builder/_select.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_select.py +1660 -0
- sqlspec/builder/_temporal.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_temporal.py +139 -0
- sqlspec/builder/_update.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_update.py +173 -0
- sqlspec/builder/_vector_expressions.py +267 -0
- sqlspec/cli.py +911 -0
- sqlspec/config.py +1755 -0
- sqlspec/core/__init__.py +374 -0
- sqlspec/core/_correlation.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/_correlation.py +176 -0
- sqlspec/core/cache.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/cache.py +1069 -0
- sqlspec/core/compiler.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/compiler.py +954 -0
- sqlspec/core/explain.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/explain.py +275 -0
- sqlspec/core/filters.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/filters.py +952 -0
- sqlspec/core/hashing.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/hashing.py +262 -0
- sqlspec/core/metrics.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/metrics.py +83 -0
- sqlspec/core/parameters/__init__.py +71 -0
- sqlspec/core/parameters/_alignment.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_alignment.py +270 -0
- sqlspec/core/parameters/_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_converter.py +543 -0
- sqlspec/core/parameters/_processor.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_processor.py +505 -0
- sqlspec/core/parameters/_registry.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_registry.py +206 -0
- sqlspec/core/parameters/_transformers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_transformers.py +292 -0
- sqlspec/core/parameters/_types.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_types.py +499 -0
- sqlspec/core/parameters/_validator.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_validator.py +180 -0
- sqlspec/core/pipeline.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/pipeline.py +319 -0
- sqlspec/core/query_modifiers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/query_modifiers.py +437 -0
- sqlspec/core/result/__init__.py +23 -0
- sqlspec/core/result/_base.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/result/_base.py +1121 -0
- sqlspec/core/result/_io.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/result/_io.py +28 -0
- sqlspec/core/splitter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/splitter.py +966 -0
- sqlspec/core/stack.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/stack.py +163 -0
- sqlspec/core/statement.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/statement.py +1503 -0
- sqlspec/core/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/type_converter.py +339 -0
- sqlspec/data_dictionary/__init__.py +22 -0
- sqlspec/data_dictionary/_loader.py +123 -0
- sqlspec/data_dictionary/_registry.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/_registry.py +74 -0
- sqlspec/data_dictionary/_types.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/_types.py +121 -0
- sqlspec/data_dictionary/dialects/__init__.py +21 -0
- sqlspec/data_dictionary/dialects/bigquery.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/bigquery.py +49 -0
- sqlspec/data_dictionary/dialects/cockroachdb.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/cockroachdb.py +43 -0
- sqlspec/data_dictionary/dialects/duckdb.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/duckdb.py +47 -0
- sqlspec/data_dictionary/dialects/mysql.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/mysql.py +42 -0
- sqlspec/data_dictionary/dialects/oracle.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/oracle.py +34 -0
- sqlspec/data_dictionary/dialects/postgres.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/postgres.py +46 -0
- sqlspec/data_dictionary/dialects/spanner.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/spanner.py +37 -0
- sqlspec/data_dictionary/dialects/sqlite.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/sqlite.py +42 -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/driver/__init__.py +32 -0
- sqlspec/driver/_async.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_async.py +1737 -0
- sqlspec/driver/_common.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_common.py +1478 -0
- sqlspec/driver/_sql_helpers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_sql_helpers.py +148 -0
- sqlspec/driver/_storage_helpers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_storage_helpers.py +144 -0
- sqlspec/driver/_sync.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_sync.py +1710 -0
- sqlspec/exceptions.py +338 -0
- sqlspec/extensions/__init__.py +0 -0
- sqlspec/extensions/adk/__init__.py +70 -0
- sqlspec/extensions/adk/_types.py +51 -0
- sqlspec/extensions/adk/converters.py +172 -0
- sqlspec/extensions/adk/memory/__init__.py +69 -0
- sqlspec/extensions/adk/memory/_types.py +30 -0
- sqlspec/extensions/adk/memory/converters.py +149 -0
- sqlspec/extensions/adk/memory/service.py +217 -0
- sqlspec/extensions/adk/memory/store.py +569 -0
- sqlspec/extensions/adk/migrations/0001_create_adk_tables.py +246 -0
- sqlspec/extensions/adk/migrations/__init__.py +0 -0
- sqlspec/extensions/adk/service.py +225 -0
- sqlspec/extensions/adk/store.py +567 -0
- sqlspec/extensions/events/__init__.py +51 -0
- sqlspec/extensions/events/_channel.py +703 -0
- sqlspec/extensions/events/_hints.py +45 -0
- sqlspec/extensions/events/_models.py +23 -0
- sqlspec/extensions/events/_payload.py +69 -0
- sqlspec/extensions/events/_protocols.py +134 -0
- sqlspec/extensions/events/_queue.py +461 -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 +19 -0
- sqlspec/extensions/fastapi/extension.py +351 -0
- sqlspec/extensions/fastapi/providers.py +607 -0
- sqlspec/extensions/flask/__init__.py +37 -0
- sqlspec/extensions/flask/_state.py +76 -0
- sqlspec/extensions/flask/_utils.py +71 -0
- sqlspec/extensions/flask/extension.py +519 -0
- sqlspec/extensions/litestar/__init__.py +28 -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 +671 -0
- sqlspec/extensions/litestar/providers.py +526 -0
- sqlspec/extensions/litestar/store.py +296 -0
- sqlspec/extensions/otel/__init__.py +58 -0
- sqlspec/extensions/prometheus/__init__.py +113 -0
- sqlspec/extensions/starlette/__init__.py +19 -0
- sqlspec/extensions/starlette/_state.py +30 -0
- sqlspec/extensions/starlette/_utils.py +96 -0
- sqlspec/extensions/starlette/extension.py +346 -0
- sqlspec/extensions/starlette/middleware.py +235 -0
- sqlspec/loader.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/loader.py +702 -0
- sqlspec/migrations/__init__.py +36 -0
- sqlspec/migrations/base.py +731 -0
- sqlspec/migrations/commands.py +1232 -0
- sqlspec/migrations/context.py +157 -0
- sqlspec/migrations/fix.py +204 -0
- sqlspec/migrations/loaders.py +443 -0
- sqlspec/migrations/runner.py +1172 -0
- sqlspec/migrations/templates.py +234 -0
- sqlspec/migrations/tracker.py +611 -0
- sqlspec/migrations/utils.py +256 -0
- sqlspec/migrations/validation.py +207 -0
- sqlspec/migrations/version.py +446 -0
- sqlspec/observability/__init__.py +55 -0
- sqlspec/observability/_common.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_common.py +77 -0
- sqlspec/observability/_config.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_config.py +348 -0
- sqlspec/observability/_diagnostics.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_diagnostics.py +74 -0
- sqlspec/observability/_dispatcher.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_dispatcher.py +152 -0
- sqlspec/observability/_formatters/__init__.py +13 -0
- sqlspec/observability/_formatters/_aws.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_formatters/_aws.py +102 -0
- sqlspec/observability/_formatters/_azure.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_formatters/_azure.py +96 -0
- sqlspec/observability/_formatters/_base.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_formatters/_base.py +57 -0
- sqlspec/observability/_formatters/_gcp.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_formatters/_gcp.py +131 -0
- sqlspec/observability/_formatting.py +58 -0
- sqlspec/observability/_observer.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_observer.py +357 -0
- sqlspec/observability/_runtime.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_runtime.py +420 -0
- sqlspec/observability/_sampling.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_sampling.py +188 -0
- sqlspec/observability/_spans.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_spans.py +161 -0
- sqlspec/protocols.py +916 -0
- sqlspec/py.typed +0 -0
- sqlspec/storage/__init__.py +48 -0
- sqlspec/storage/_utils.py +104 -0
- sqlspec/storage/backends/__init__.py +1 -0
- sqlspec/storage/backends/base.py +253 -0
- sqlspec/storage/backends/fsspec.py +529 -0
- sqlspec/storage/backends/local.py +441 -0
- sqlspec/storage/backends/obstore.py +916 -0
- sqlspec/storage/errors.py +104 -0
- sqlspec/storage/pipeline.py +582 -0
- sqlspec/storage/registry.py +301 -0
- sqlspec/typing.py +395 -0
- sqlspec/utils/__init__.py +7 -0
- sqlspec/utils/arrow_helpers.py +318 -0
- sqlspec/utils/config_tools.py +332 -0
- sqlspec/utils/correlation.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/correlation.py +134 -0
- sqlspec/utils/deprecation.py +190 -0
- sqlspec/utils/fixtures.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/fixtures.py +258 -0
- sqlspec/utils/logging.py +222 -0
- sqlspec/utils/module_loader.py +306 -0
- sqlspec/utils/portal.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/portal.py +375 -0
- sqlspec/utils/schema.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/schema.py +485 -0
- sqlspec/utils/serializers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/serializers.py +408 -0
- sqlspec/utils/singleton.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/singleton.py +41 -0
- sqlspec/utils/sync_tools.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/sync_tools.py +311 -0
- sqlspec/utils/text.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/text.py +108 -0
- sqlspec/utils/type_converters.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/type_converters.py +128 -0
- sqlspec/utils/type_guards.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/type_guards.py +1360 -0
- sqlspec/utils/uuids.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/uuids.py +225 -0
- sqlspec-0.36.0.dist-info/METADATA +205 -0
- sqlspec-0.36.0.dist-info/RECORD +531 -0
- sqlspec-0.36.0.dist-info/WHEEL +7 -0
- sqlspec-0.36.0.dist-info/entry_points.txt +2 -0
- sqlspec-0.36.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""MySQL-specific data dictionary for metadata queries via asyncmy."""
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, ClassVar
|
|
4
|
+
|
|
5
|
+
from mypy_extensions import mypyc_attr
|
|
6
|
+
|
|
7
|
+
from sqlspec.driver import AsyncDataDictionaryBase
|
|
8
|
+
from sqlspec.typing import ColumnMetadata, ForeignKeyMetadata, IndexMetadata, TableMetadata, VersionInfo
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from sqlspec.adapters.asyncmy.driver import AsyncmyDriver
|
|
12
|
+
|
|
13
|
+
__all__ = ("AsyncmyDataDictionary",)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@mypyc_attr(allow_interpreted_subclasses=True, native_class=False)
|
|
17
|
+
class AsyncmyDataDictionary(AsyncDataDictionaryBase):
|
|
18
|
+
"""MySQL-specific async data dictionary."""
|
|
19
|
+
|
|
20
|
+
dialect: ClassVar[str] = "mysql"
|
|
21
|
+
|
|
22
|
+
def __init__(self) -> None:
|
|
23
|
+
super().__init__()
|
|
24
|
+
|
|
25
|
+
async def get_version(self, driver: "AsyncmyDriver") -> "VersionInfo | None":
|
|
26
|
+
"""Get MySQL database version information."""
|
|
27
|
+
driver_id = id(driver)
|
|
28
|
+
# Inline cache check to avoid cross-module method call that causes mypyc segfault
|
|
29
|
+
if driver_id in self._version_fetch_attempted:
|
|
30
|
+
return self._version_cache.get(driver_id)
|
|
31
|
+
# Not cached, fetch from database
|
|
32
|
+
|
|
33
|
+
version_value = await driver.select_value_or_none(self.get_query("version"))
|
|
34
|
+
if not version_value:
|
|
35
|
+
self._log_version_unavailable(type(self).dialect, "missing")
|
|
36
|
+
self.cache_version(driver_id, None)
|
|
37
|
+
return None
|
|
38
|
+
|
|
39
|
+
version_info = self.parse_version_with_pattern(self.get_dialect_config().version_pattern, str(version_value))
|
|
40
|
+
if version_info is None:
|
|
41
|
+
self._log_version_unavailable(type(self).dialect, "parse_failed")
|
|
42
|
+
self.cache_version(driver_id, None)
|
|
43
|
+
return None
|
|
44
|
+
|
|
45
|
+
self._log_version_detected(type(self).dialect, version_info)
|
|
46
|
+
self.cache_version(driver_id, version_info)
|
|
47
|
+
return version_info
|
|
48
|
+
|
|
49
|
+
async def get_feature_flag(self, driver: "AsyncmyDriver", feature: str) -> bool:
|
|
50
|
+
"""Check if MySQL database supports a specific feature."""
|
|
51
|
+
version_info = await self.get_version(driver)
|
|
52
|
+
return self.resolve_feature_flag(feature, version_info)
|
|
53
|
+
|
|
54
|
+
async def get_optimal_type(self, driver: "AsyncmyDriver", type_category: str) -> str:
|
|
55
|
+
"""Get optimal MySQL type for a category."""
|
|
56
|
+
config = self.get_dialect_config()
|
|
57
|
+
version_info = await self.get_version(driver)
|
|
58
|
+
|
|
59
|
+
if type_category == "json":
|
|
60
|
+
json_version = config.get_feature_version("supports_json")
|
|
61
|
+
if version_info and json_version and version_info >= json_version:
|
|
62
|
+
return "JSON"
|
|
63
|
+
return "TEXT"
|
|
64
|
+
|
|
65
|
+
return config.get_optimal_type(type_category)
|
|
66
|
+
|
|
67
|
+
async def get_tables(self, driver: "AsyncmyDriver", schema: "str | None" = None) -> "list[TableMetadata]":
|
|
68
|
+
"""Get tables sorted by topological dependency order using the MySQL catalog."""
|
|
69
|
+
schema_name = self.resolve_schema(schema)
|
|
70
|
+
self._log_schema_introspect(driver, schema_name=schema_name, table_name=None, operation="tables")
|
|
71
|
+
return await driver.select(
|
|
72
|
+
self.get_query("tables_by_schema"), schema_name=schema_name, schema_type=TableMetadata
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
async def get_columns(
|
|
76
|
+
self, driver: "AsyncmyDriver", table: "str | None" = None, schema: "str | None" = None
|
|
77
|
+
) -> "list[ColumnMetadata]":
|
|
78
|
+
"""Get column information for a table or schema."""
|
|
79
|
+
schema_name = self.resolve_schema(schema)
|
|
80
|
+
if table is None:
|
|
81
|
+
self._log_schema_introspect(driver, schema_name=schema_name, table_name=None, operation="columns")
|
|
82
|
+
return await driver.select(
|
|
83
|
+
self.get_query("columns_by_schema"), schema_name=schema_name, schema_type=ColumnMetadata
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
self._log_table_describe(driver, schema_name=schema_name, table_name=table, operation="columns")
|
|
87
|
+
return await driver.select(
|
|
88
|
+
self.get_query("columns_by_table"), table_name=table, schema_name=schema_name, schema_type=ColumnMetadata
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
async def get_indexes(
|
|
92
|
+
self, driver: "AsyncmyDriver", table: "str | None" = None, schema: "str | None" = None
|
|
93
|
+
) -> "list[IndexMetadata]":
|
|
94
|
+
"""Get index metadata for a table or schema."""
|
|
95
|
+
schema_name = self.resolve_schema(schema)
|
|
96
|
+
if table is None:
|
|
97
|
+
self._log_schema_introspect(driver, schema_name=schema_name, table_name=None, operation="indexes")
|
|
98
|
+
return await driver.select(
|
|
99
|
+
self.get_query("indexes_by_schema"), schema_name=schema_name, schema_type=IndexMetadata
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
self._log_table_describe(driver, schema_name=schema_name, table_name=table, operation="indexes")
|
|
103
|
+
return await driver.select(
|
|
104
|
+
self.get_query("indexes_by_table"), table_name=table, schema_name=schema_name, schema_type=IndexMetadata
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
async def get_foreign_keys(
|
|
108
|
+
self, driver: "AsyncmyDriver", table: "str | None" = None, schema: "str | None" = None
|
|
109
|
+
) -> "list[ForeignKeyMetadata]":
|
|
110
|
+
"""Get foreign key metadata."""
|
|
111
|
+
schema_name = self.resolve_schema(schema)
|
|
112
|
+
if table is None:
|
|
113
|
+
self._log_schema_introspect(driver, schema_name=schema_name, table_name=None, operation="foreign_keys")
|
|
114
|
+
return await driver.select(
|
|
115
|
+
self.get_query("foreign_keys_by_schema"), schema_name=schema_name, schema_type=ForeignKeyMetadata
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
self._log_table_describe(driver, schema_name=schema_name, table_name=table, operation="foreign_keys")
|
|
119
|
+
return await driver.select(
|
|
120
|
+
self.get_query("foreign_keys_by_table"),
|
|
121
|
+
table_name=table,
|
|
122
|
+
schema_name=schema_name,
|
|
123
|
+
schema_type=ForeignKeyMetadata,
|
|
124
|
+
)
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
"""AsyncMy MySQL driver implementation.
|
|
2
|
+
|
|
3
|
+
Provides MySQL/MariaDB connectivity with parameter style conversion,
|
|
4
|
+
type coercion, error handling, and transaction management.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import TYPE_CHECKING, Any, Final, cast
|
|
8
|
+
|
|
9
|
+
import asyncmy.errors # pyright: ignore
|
|
10
|
+
from asyncmy.constants import FIELD_TYPE as ASYNC_MY_FIELD_TYPE # pyright: ignore
|
|
11
|
+
from asyncmy.cursors import Cursor, DictCursor # pyright: ignore
|
|
12
|
+
|
|
13
|
+
from sqlspec.adapters.asyncmy.core import (
|
|
14
|
+
build_insert_statement,
|
|
15
|
+
collect_rows,
|
|
16
|
+
create_mapped_exception,
|
|
17
|
+
default_statement_config,
|
|
18
|
+
detect_json_columns,
|
|
19
|
+
driver_profile,
|
|
20
|
+
format_identifier,
|
|
21
|
+
normalize_execute_many_parameters,
|
|
22
|
+
normalize_execute_parameters,
|
|
23
|
+
normalize_lastrowid,
|
|
24
|
+
resolve_rowcount,
|
|
25
|
+
)
|
|
26
|
+
from sqlspec.adapters.asyncmy.data_dictionary import AsyncmyDataDictionary
|
|
27
|
+
from sqlspec.core import ArrowResult, get_cache_config, register_driver_profile
|
|
28
|
+
from sqlspec.driver import AsyncDriverAdapterBase
|
|
29
|
+
from sqlspec.exceptions import SQLSpecError
|
|
30
|
+
from sqlspec.utils.logging import get_logger
|
|
31
|
+
from sqlspec.utils.serializers import from_json
|
|
32
|
+
from sqlspec.utils.type_guards import supports_json_type
|
|
33
|
+
|
|
34
|
+
if TYPE_CHECKING:
|
|
35
|
+
from collections.abc import Callable
|
|
36
|
+
|
|
37
|
+
from sqlspec.adapters.asyncmy._typing import AsyncmyConnection
|
|
38
|
+
from sqlspec.core import SQL, StatementConfig
|
|
39
|
+
from sqlspec.driver import ExecutionResult
|
|
40
|
+
from sqlspec.storage import StorageBridgeJob, StorageDestination, StorageFormat, StorageTelemetry
|
|
41
|
+
|
|
42
|
+
from sqlspec.adapters.asyncmy._typing import AsyncmySessionContext
|
|
43
|
+
|
|
44
|
+
__all__ = ("AsyncmyCursor", "AsyncmyDriver", "AsyncmyExceptionHandler", "AsyncmySessionContext")
|
|
45
|
+
|
|
46
|
+
logger = get_logger(__name__)
|
|
47
|
+
|
|
48
|
+
json_type_value = (
|
|
49
|
+
ASYNC_MY_FIELD_TYPE.JSON if ASYNC_MY_FIELD_TYPE is not None and supports_json_type(ASYNC_MY_FIELD_TYPE) else None
|
|
50
|
+
)
|
|
51
|
+
ASYNCMY_JSON_TYPE_CODES: Final[set[int]] = {json_type_value} if json_type_value is not None else set()
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class AsyncmyCursor:
|
|
55
|
+
"""Context manager for AsyncMy cursor operations.
|
|
56
|
+
|
|
57
|
+
Provides automatic cursor acquisition and cleanup for database operations.
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
__slots__ = ("connection", "cursor")
|
|
61
|
+
|
|
62
|
+
def __init__(self, connection: "AsyncmyConnection") -> None:
|
|
63
|
+
self.connection = connection
|
|
64
|
+
self.cursor: Cursor | DictCursor | None = None
|
|
65
|
+
|
|
66
|
+
async def __aenter__(self) -> Cursor | DictCursor:
|
|
67
|
+
self.cursor = self.connection.cursor()
|
|
68
|
+
return self.cursor
|
|
69
|
+
|
|
70
|
+
async def __aexit__(self, *_: Any) -> None:
|
|
71
|
+
if self.cursor is not None:
|
|
72
|
+
await self.cursor.close()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class AsyncmyExceptionHandler:
|
|
76
|
+
"""Async context manager for handling asyncmy (MySQL) database exceptions.
|
|
77
|
+
|
|
78
|
+
Maps MySQL error codes and SQLSTATE to specific SQLSpec exceptions
|
|
79
|
+
for better error handling in application code.
|
|
80
|
+
|
|
81
|
+
Uses deferred exception pattern for mypyc compatibility: exceptions
|
|
82
|
+
are stored in pending_exception rather than raised from __aexit__
|
|
83
|
+
to avoid ABI boundary violations with compiled code.
|
|
84
|
+
"""
|
|
85
|
+
|
|
86
|
+
__slots__ = ("pending_exception",)
|
|
87
|
+
|
|
88
|
+
def __init__(self) -> None:
|
|
89
|
+
self.pending_exception: Exception | None = None
|
|
90
|
+
|
|
91
|
+
async def __aenter__(self) -> "AsyncmyExceptionHandler":
|
|
92
|
+
return self
|
|
93
|
+
|
|
94
|
+
async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool:
|
|
95
|
+
if exc_type is None:
|
|
96
|
+
return False
|
|
97
|
+
if issubclass(exc_type, asyncmy.errors.Error):
|
|
98
|
+
result = create_mapped_exception(exc_val, logger=logger)
|
|
99
|
+
if result is True:
|
|
100
|
+
return True
|
|
101
|
+
self.pending_exception = cast("Exception", result)
|
|
102
|
+
return True
|
|
103
|
+
return False
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class AsyncmyDriver(AsyncDriverAdapterBase):
|
|
107
|
+
"""MySQL/MariaDB database driver using AsyncMy client library.
|
|
108
|
+
|
|
109
|
+
Implements asynchronous database operations for MySQL and MariaDB servers
|
|
110
|
+
with support for parameter style conversion, type coercion, error handling,
|
|
111
|
+
and transaction management.
|
|
112
|
+
"""
|
|
113
|
+
|
|
114
|
+
__slots__ = ("_data_dictionary",)
|
|
115
|
+
dialect = "mysql"
|
|
116
|
+
|
|
117
|
+
def __init__(
|
|
118
|
+
self,
|
|
119
|
+
connection: "AsyncmyConnection",
|
|
120
|
+
statement_config: "StatementConfig | None" = None,
|
|
121
|
+
driver_features: "dict[str, Any] | None" = None,
|
|
122
|
+
) -> None:
|
|
123
|
+
if statement_config is None:
|
|
124
|
+
statement_config = default_statement_config.replace(
|
|
125
|
+
enable_caching=get_cache_config().compiled_cache_enabled
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
super().__init__(connection=connection, statement_config=statement_config, driver_features=driver_features)
|
|
129
|
+
self._data_dictionary: AsyncmyDataDictionary | None = None
|
|
130
|
+
|
|
131
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
132
|
+
# CORE DISPATCH METHODS - The Execution Engine
|
|
133
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
134
|
+
|
|
135
|
+
async def dispatch_execute(self, cursor: Any, statement: "SQL") -> "ExecutionResult":
|
|
136
|
+
"""Execute single SQL statement.
|
|
137
|
+
|
|
138
|
+
Handles parameter processing, result fetching, and data transformation
|
|
139
|
+
for MySQL/MariaDB operations.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
cursor: AsyncMy cursor object
|
|
143
|
+
statement: SQL statement to execute
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
ExecutionResult: Statement execution results with data or row counts
|
|
147
|
+
"""
|
|
148
|
+
sql, prepared_parameters = self._get_compiled_sql(statement, self.statement_config)
|
|
149
|
+
await cursor.execute(sql, normalize_execute_parameters(prepared_parameters))
|
|
150
|
+
|
|
151
|
+
if statement.returns_rows():
|
|
152
|
+
fetched_data = await cursor.fetchall()
|
|
153
|
+
fetched_rows = list(fetched_data) if fetched_data else None
|
|
154
|
+
description = list(cursor.description) if cursor.description else None
|
|
155
|
+
json_indexes = detect_json_columns(cursor, ASYNCMY_JSON_TYPE_CODES)
|
|
156
|
+
deserializer = cast("Callable[[Any], Any]", self.driver_features.get("json_deserializer", from_json))
|
|
157
|
+
rows, column_names = collect_rows(fetched_rows, description, json_indexes, deserializer, logger=logger)
|
|
158
|
+
|
|
159
|
+
return self.create_execution_result(
|
|
160
|
+
cursor, selected_data=rows, column_names=column_names, data_row_count=len(rows), is_select_result=True
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
affected_rows = resolve_rowcount(cursor)
|
|
164
|
+
last_id = normalize_lastrowid(cursor)
|
|
165
|
+
return self.create_execution_result(cursor, rowcount_override=affected_rows, last_inserted_id=last_id)
|
|
166
|
+
|
|
167
|
+
async def dispatch_execute_many(self, cursor: Any, statement: "SQL") -> "ExecutionResult":
|
|
168
|
+
"""Execute SQL statement with multiple parameter sets.
|
|
169
|
+
|
|
170
|
+
Uses AsyncMy's executemany for batch operations with MySQL type conversion
|
|
171
|
+
and parameter processing.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
cursor: AsyncMy cursor object
|
|
175
|
+
statement: SQL statement with multiple parameter sets
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
ExecutionResult: Batch execution results
|
|
179
|
+
|
|
180
|
+
Raises:
|
|
181
|
+
ValueError: If no parameters provided for executemany operation
|
|
182
|
+
"""
|
|
183
|
+
sql, prepared_parameters = self._get_compiled_sql(statement, self.statement_config)
|
|
184
|
+
|
|
185
|
+
prepared_parameters = normalize_execute_many_parameters(prepared_parameters)
|
|
186
|
+
await cursor.executemany(sql, prepared_parameters)
|
|
187
|
+
|
|
188
|
+
affected_rows = len(prepared_parameters)
|
|
189
|
+
|
|
190
|
+
return self.create_execution_result(cursor, rowcount_override=affected_rows, is_many_result=True)
|
|
191
|
+
|
|
192
|
+
async def dispatch_execute_script(self, cursor: Any, statement: "SQL") -> "ExecutionResult":
|
|
193
|
+
"""Execute SQL script with statement splitting and parameter handling.
|
|
194
|
+
|
|
195
|
+
Splits multi-statement scripts and executes each statement sequentially.
|
|
196
|
+
Parameters are embedded as static values for script execution compatibility.
|
|
197
|
+
|
|
198
|
+
Args:
|
|
199
|
+
cursor: AsyncMy cursor object
|
|
200
|
+
statement: SQL script to execute
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
ExecutionResult: Script execution results with statement count
|
|
204
|
+
"""
|
|
205
|
+
sql, prepared_parameters = self._get_compiled_sql(statement, self.statement_config)
|
|
206
|
+
statements = self.split_script_statements(sql, statement.statement_config, strip_trailing_semicolon=True)
|
|
207
|
+
|
|
208
|
+
successful_count = 0
|
|
209
|
+
last_cursor = cursor
|
|
210
|
+
|
|
211
|
+
for stmt in statements:
|
|
212
|
+
await cursor.execute(stmt, normalize_execute_parameters(prepared_parameters))
|
|
213
|
+
successful_count += 1
|
|
214
|
+
|
|
215
|
+
return self.create_execution_result(
|
|
216
|
+
last_cursor, statement_count=len(statements), successful_statements=successful_count, is_script_result=True
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
220
|
+
# TRANSACTION MANAGEMENT
|
|
221
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
222
|
+
|
|
223
|
+
async def begin(self) -> None:
|
|
224
|
+
"""Begin a database transaction.
|
|
225
|
+
|
|
226
|
+
Explicitly starts a MySQL transaction to ensure proper transaction boundaries.
|
|
227
|
+
|
|
228
|
+
Raises:
|
|
229
|
+
SQLSpecError: If transaction initialization fails
|
|
230
|
+
"""
|
|
231
|
+
try:
|
|
232
|
+
async with AsyncmyCursor(self.connection) as cursor:
|
|
233
|
+
await cursor.execute("BEGIN")
|
|
234
|
+
except asyncmy.errors.MySQLError as e:
|
|
235
|
+
msg = f"Failed to begin MySQL transaction: {e}"
|
|
236
|
+
raise SQLSpecError(msg) from e
|
|
237
|
+
|
|
238
|
+
async def commit(self) -> None:
|
|
239
|
+
"""Commit the current transaction.
|
|
240
|
+
|
|
241
|
+
Raises:
|
|
242
|
+
SQLSpecError: If transaction commit fails
|
|
243
|
+
"""
|
|
244
|
+
try:
|
|
245
|
+
await self.connection.commit()
|
|
246
|
+
except asyncmy.errors.MySQLError as e:
|
|
247
|
+
msg = f"Failed to commit MySQL transaction: {e}"
|
|
248
|
+
raise SQLSpecError(msg) from e
|
|
249
|
+
|
|
250
|
+
async def rollback(self) -> None:
|
|
251
|
+
"""Rollback the current transaction.
|
|
252
|
+
|
|
253
|
+
Raises:
|
|
254
|
+
SQLSpecError: If transaction rollback fails
|
|
255
|
+
"""
|
|
256
|
+
try:
|
|
257
|
+
await self.connection.rollback()
|
|
258
|
+
except asyncmy.errors.MySQLError as e:
|
|
259
|
+
msg = f"Failed to rollback MySQL transaction: {e}"
|
|
260
|
+
raise SQLSpecError(msg) from e
|
|
261
|
+
|
|
262
|
+
def with_cursor(self, connection: "AsyncmyConnection") -> "AsyncmyCursor":
|
|
263
|
+
"""Create cursor context manager for the connection.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
connection: AsyncMy database connection
|
|
267
|
+
|
|
268
|
+
Returns:
|
|
269
|
+
AsyncmyCursor: Context manager for cursor operations
|
|
270
|
+
"""
|
|
271
|
+
return AsyncmyCursor(connection)
|
|
272
|
+
|
|
273
|
+
def handle_database_exceptions(self) -> "AsyncmyExceptionHandler":
|
|
274
|
+
"""Provide exception handling context manager.
|
|
275
|
+
|
|
276
|
+
Returns:
|
|
277
|
+
AsyncmyExceptionHandler: Context manager for AsyncMy exception handling
|
|
278
|
+
"""
|
|
279
|
+
return AsyncmyExceptionHandler()
|
|
280
|
+
|
|
281
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
282
|
+
# STORAGE API METHODS
|
|
283
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
284
|
+
|
|
285
|
+
async def select_to_storage(
|
|
286
|
+
self,
|
|
287
|
+
statement: "SQL | str",
|
|
288
|
+
destination: "StorageDestination",
|
|
289
|
+
/,
|
|
290
|
+
*parameters: Any,
|
|
291
|
+
statement_config: "StatementConfig | None" = None,
|
|
292
|
+
partitioner: "dict[str, object] | None" = None,
|
|
293
|
+
format_hint: "StorageFormat | None" = None,
|
|
294
|
+
telemetry: "StorageTelemetry | None" = None,
|
|
295
|
+
**kwargs: Any,
|
|
296
|
+
) -> "StorageBridgeJob":
|
|
297
|
+
"""Execute a query and stream Arrow-formatted results into storage."""
|
|
298
|
+
|
|
299
|
+
self._require_capability("arrow_export_enabled")
|
|
300
|
+
arrow_result = await self.select_to_arrow(statement, *parameters, statement_config=statement_config, **kwargs)
|
|
301
|
+
async_pipeline = self._storage_pipeline()
|
|
302
|
+
telemetry_payload = await self._write_result_to_storage_async(
|
|
303
|
+
arrow_result, destination, format_hint=format_hint, pipeline=async_pipeline
|
|
304
|
+
)
|
|
305
|
+
self._attach_partition_telemetry(telemetry_payload, partitioner)
|
|
306
|
+
return self._create_storage_job(telemetry_payload, telemetry)
|
|
307
|
+
|
|
308
|
+
async def load_from_arrow(
|
|
309
|
+
self,
|
|
310
|
+
table: str,
|
|
311
|
+
source: "ArrowResult | Any",
|
|
312
|
+
*,
|
|
313
|
+
partitioner: "dict[str, object] | None" = None,
|
|
314
|
+
overwrite: bool = False,
|
|
315
|
+
telemetry: "StorageTelemetry | None" = None,
|
|
316
|
+
) -> "StorageBridgeJob":
|
|
317
|
+
"""Load Arrow data into MySQL using batched inserts."""
|
|
318
|
+
|
|
319
|
+
self._require_capability("arrow_import_enabled")
|
|
320
|
+
arrow_table = self._coerce_arrow_table(source)
|
|
321
|
+
if overwrite:
|
|
322
|
+
statement = f"TRUNCATE TABLE {format_identifier(table)}"
|
|
323
|
+
async with self.handle_database_exceptions(), self.with_cursor(self.connection) as cursor:
|
|
324
|
+
await cursor.execute(statement)
|
|
325
|
+
|
|
326
|
+
columns, records = self._arrow_table_to_rows(arrow_table)
|
|
327
|
+
if records:
|
|
328
|
+
insert_sql = build_insert_statement(table, columns)
|
|
329
|
+
async with self.handle_database_exceptions(), self.with_cursor(self.connection) as cursor:
|
|
330
|
+
await cursor.executemany(insert_sql, records)
|
|
331
|
+
|
|
332
|
+
telemetry_payload = self._build_ingest_telemetry(arrow_table)
|
|
333
|
+
telemetry_payload["destination"] = table
|
|
334
|
+
self._attach_partition_telemetry(telemetry_payload, partitioner)
|
|
335
|
+
return self._create_storage_job(telemetry_payload, telemetry)
|
|
336
|
+
|
|
337
|
+
async def load_from_storage(
|
|
338
|
+
self,
|
|
339
|
+
table: str,
|
|
340
|
+
source: "StorageDestination",
|
|
341
|
+
*,
|
|
342
|
+
file_format: "StorageFormat",
|
|
343
|
+
partitioner: "dict[str, object] | None" = None,
|
|
344
|
+
overwrite: bool = False,
|
|
345
|
+
) -> "StorageBridgeJob":
|
|
346
|
+
"""Load staged artifacts from storage into MySQL."""
|
|
347
|
+
|
|
348
|
+
arrow_table, inbound = await self._read_arrow_from_storage_async(source, file_format=file_format)
|
|
349
|
+
return await self.load_from_arrow(
|
|
350
|
+
table, arrow_table, partitioner=partitioner, overwrite=overwrite, telemetry=inbound
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
354
|
+
# UTILITY METHODS
|
|
355
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
356
|
+
|
|
357
|
+
@property
|
|
358
|
+
def data_dictionary(self) -> "AsyncmyDataDictionary":
|
|
359
|
+
"""Get the data dictionary for this driver.
|
|
360
|
+
|
|
361
|
+
Returns:
|
|
362
|
+
Data dictionary instance for metadata queries
|
|
363
|
+
"""
|
|
364
|
+
if self._data_dictionary is None:
|
|
365
|
+
self._data_dictionary = AsyncmyDataDictionary()
|
|
366
|
+
return self._data_dictionary
|
|
367
|
+
|
|
368
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
369
|
+
# PRIVATE/INTERNAL METHODS
|
|
370
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
371
|
+
|
|
372
|
+
def _connection_in_transaction(self) -> bool:
|
|
373
|
+
"""Check if connection is in transaction.
|
|
374
|
+
|
|
375
|
+
AsyncMy uses explicit BEGIN and does not expose reliable transaction state.
|
|
376
|
+
|
|
377
|
+
Returns:
|
|
378
|
+
False - AsyncMy requires explicit transaction management.
|
|
379
|
+
"""
|
|
380
|
+
return False
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
register_driver_profile("asyncmy", driver_profile)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"""AsyncMy event queue store with MySQL-specific DDL.
|
|
2
|
+
|
|
3
|
+
MySQL requires:
|
|
4
|
+
- JSON type for payload/metadata (5.7.8+)
|
|
5
|
+
- DATETIME(6) for microsecond precision timestamps
|
|
6
|
+
- Procedural SQL for conditional index creation (no IF NOT EXISTS for indexes)
|
|
7
|
+
- Information schema queries for existence checks
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from typing import Final
|
|
11
|
+
|
|
12
|
+
from sqlspec.adapters.asyncmy import AsyncmyConfig
|
|
13
|
+
from sqlspec.extensions.events import BaseEventQueueStore
|
|
14
|
+
|
|
15
|
+
__all__ = ("AsyncmyEventQueueStore",)
|
|
16
|
+
|
|
17
|
+
SCHEMA_QUALIFIED_SEGMENTS: Final[int] = 2
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class AsyncmyEventQueueStore(BaseEventQueueStore[AsyncmyConfig]):
|
|
21
|
+
"""MySQL-specific event queue store with conditional DDL.
|
|
22
|
+
|
|
23
|
+
Generates DDL optimized for MySQL 5.7.8+ using native JSON type.
|
|
24
|
+
Index creation uses procedural SQL to check for existing indexes
|
|
25
|
+
since MySQL does not support IF NOT EXISTS for indexes.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
config: AsyncmyConfig with extension_config["events"] settings.
|
|
29
|
+
|
|
30
|
+
Notes:
|
|
31
|
+
Configuration is read from config.extension_config["events"]:
|
|
32
|
+
- queue_table: Table name (default: "sqlspec_event_queue")
|
|
33
|
+
|
|
34
|
+
Example:
|
|
35
|
+
from sqlspec.adapters.asyncmy import AsyncmyConfig
|
|
36
|
+
from sqlspec.adapters.asyncmy.events import AsyncmyEventQueueStore
|
|
37
|
+
|
|
38
|
+
config = AsyncmyConfig(
|
|
39
|
+
connection_config={"host": "localhost", "database": "mydb"},
|
|
40
|
+
extension_config={"events": {"queue_table": "my_events"}}
|
|
41
|
+
)
|
|
42
|
+
store = AsyncmyEventQueueStore(config)
|
|
43
|
+
for stmt in store.create_statements():
|
|
44
|
+
await driver.execute_script(stmt)
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
__slots__ = ()
|
|
48
|
+
|
|
49
|
+
def _column_types(self) -> "tuple[str, str, str]":
|
|
50
|
+
"""Return MySQL-specific column types.
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
Tuple of (payload_type, metadata_type, timestamp_type).
|
|
54
|
+
Uses JSON for payload/metadata and DATETIME(6) for microsecond timestamps.
|
|
55
|
+
"""
|
|
56
|
+
return "JSON", "JSON", "DATETIME(6)"
|
|
57
|
+
|
|
58
|
+
def _timestamp_default(self) -> str:
|
|
59
|
+
"""Return MySQL timestamp default expression.
|
|
60
|
+
|
|
61
|
+
MySQL requires CURRENT_TIMESTAMP(6) for DATETIME(6) columns,
|
|
62
|
+
not just CURRENT_TIMESTAMP which is only valid for TIMESTAMP type.
|
|
63
|
+
|
|
64
|
+
Returns:
|
|
65
|
+
MySQL-specific timestamp default with microsecond precision.
|
|
66
|
+
"""
|
|
67
|
+
return "CURRENT_TIMESTAMP(6)"
|
|
68
|
+
|
|
69
|
+
def _build_index_sql(self) -> str | None:
|
|
70
|
+
"""Build MySQL conditional index creation SQL.
|
|
71
|
+
|
|
72
|
+
MySQL does not support IF NOT EXISTS for CREATE INDEX, so this method
|
|
73
|
+
generates procedural SQL that checks information_schema.statistics
|
|
74
|
+
before attempting to create the index.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
Procedural SQL script for conditional index creation.
|
|
78
|
+
"""
|
|
79
|
+
table_name = self.table_name
|
|
80
|
+
segments = table_name.split(".", 1)
|
|
81
|
+
|
|
82
|
+
if len(segments) == SCHEMA_QUALIFIED_SEGMENTS:
|
|
83
|
+
schema = segments[0]
|
|
84
|
+
table = segments[1]
|
|
85
|
+
schema_selector = f"'{schema}'"
|
|
86
|
+
else:
|
|
87
|
+
table = segments[0]
|
|
88
|
+
schema_selector = "DATABASE()"
|
|
89
|
+
|
|
90
|
+
index_name = self._index_name()
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
"SET @sqlspec_events_idx_exists := ("
|
|
94
|
+
"SELECT COUNT(1) FROM information_schema.statistics "
|
|
95
|
+
f"WHERE table_schema = {schema_selector} "
|
|
96
|
+
f"AND table_name = '{table}' "
|
|
97
|
+
f"AND index_name = '{index_name}');"
|
|
98
|
+
"SET @sqlspec_events_idx_stmt := IF(@sqlspec_events_idx_exists = 0, "
|
|
99
|
+
f"'ALTER TABLE {table_name} ADD INDEX {index_name} (channel, status, available_at)', "
|
|
100
|
+
"'SELECT 1');"
|
|
101
|
+
"PREPARE sqlspec_events_stmt FROM @sqlspec_events_idx_stmt;"
|
|
102
|
+
"EXECUTE sqlspec_events_stmt;"
|
|
103
|
+
"DEALLOCATE PREPARE sqlspec_events_stmt;"
|
|
104
|
+
)
|