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
sqlspec/protocols.py
ADDED
|
@@ -0,0 +1,916 @@
|
|
|
1
|
+
"""Runtime-checkable protocols for type safety and runtime checks.
|
|
2
|
+
|
|
3
|
+
This module provides protocols that can be used for static type checking
|
|
4
|
+
and runtime isinstance() checks.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import TYPE_CHECKING, Any, Protocol, overload, runtime_checkable
|
|
8
|
+
|
|
9
|
+
from typing_extensions import Self
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from collections.abc import AsyncIterator, Callable, Iterator, Mapping, Sequence
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
from sqlglot import exp
|
|
16
|
+
from sqlglot.dialects.dialect import DialectType
|
|
17
|
+
|
|
18
|
+
from sqlspec.config import ExtensionConfigs
|
|
19
|
+
from sqlspec.core import StatementConfig
|
|
20
|
+
from sqlspec.typing import (
|
|
21
|
+
ArrowRecordBatch,
|
|
22
|
+
ArrowTable,
|
|
23
|
+
ColumnMetadata,
|
|
24
|
+
ForeignKeyMetadata,
|
|
25
|
+
IndexMetadata,
|
|
26
|
+
TableMetadata,
|
|
27
|
+
VersionInfo,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
__all__ = (
|
|
31
|
+
"ArrowTableStatsProtocol",
|
|
32
|
+
"AsyncDataDictionaryProtocol",
|
|
33
|
+
"AsyncDeleteProtocol",
|
|
34
|
+
"AsyncReadBytesProtocol",
|
|
35
|
+
"AsyncReadableProtocol",
|
|
36
|
+
"AsyncWriteBytesProtocol",
|
|
37
|
+
"CursorMetadataProtocol",
|
|
38
|
+
"DictProtocol",
|
|
39
|
+
"HasAddListenerProtocol",
|
|
40
|
+
"HasConfigProtocol",
|
|
41
|
+
"HasConnectionConfigProtocol",
|
|
42
|
+
"HasDataProtocol",
|
|
43
|
+
"HasDatabaseUrlAndBindKeyProtocol",
|
|
44
|
+
"HasErrorsProtocol",
|
|
45
|
+
"HasExecuteProtocol",
|
|
46
|
+
"HasExpressionAndParametersProtocol",
|
|
47
|
+
"HasExpressionAndSQLProtocol",
|
|
48
|
+
"HasExpressionProtocol",
|
|
49
|
+
"HasExtensionConfigProtocol",
|
|
50
|
+
"HasFieldNameProtocol",
|
|
51
|
+
"HasFilterAttributesProtocol",
|
|
52
|
+
"HasGetDataProtocol",
|
|
53
|
+
"HasLastRowIdProtocol",
|
|
54
|
+
"HasMigrationConfigProtocol",
|
|
55
|
+
"HasNameProtocol",
|
|
56
|
+
"HasNotifiesProtocol",
|
|
57
|
+
"HasParameterBuilderProtocol",
|
|
58
|
+
"HasRowcountProtocol",
|
|
59
|
+
"HasSQLGlotExpressionProtocol",
|
|
60
|
+
"HasSqlStateProtocol",
|
|
61
|
+
"HasSqliteErrorProtocol",
|
|
62
|
+
"HasStatementConfigFactoryProtocol",
|
|
63
|
+
"HasStatementConfigProtocol",
|
|
64
|
+
"HasStatementTypeProtocol",
|
|
65
|
+
"HasTracerProviderProtocol",
|
|
66
|
+
"HasTypeCodeProtocol",
|
|
67
|
+
"HasTypecodeProtocol",
|
|
68
|
+
"HasTypecodeSizedProtocol",
|
|
69
|
+
"HasValueProtocol",
|
|
70
|
+
"HasWhereProtocol",
|
|
71
|
+
"NotificationProtocol",
|
|
72
|
+
"ObjectStoreProtocol",
|
|
73
|
+
"PipelineCapableProtocol",
|
|
74
|
+
"QueryResultProtocol",
|
|
75
|
+
"ReadableProtocol",
|
|
76
|
+
"SQLBuilderProtocol",
|
|
77
|
+
"SpanAttributeProtocol",
|
|
78
|
+
"SpannerParamTypesProtocol",
|
|
79
|
+
"StatementProtocol",
|
|
80
|
+
"SupportsArrayProtocol",
|
|
81
|
+
"SupportsArrowResults",
|
|
82
|
+
"SupportsCloseProtocol",
|
|
83
|
+
"SupportsDtypeStrProtocol",
|
|
84
|
+
"SupportsJsonTypeProtocol",
|
|
85
|
+
"SyncDataDictionaryProtocol",
|
|
86
|
+
"WithMethodProtocol",
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@runtime_checkable
|
|
91
|
+
class ReadableProtocol(Protocol):
|
|
92
|
+
"""Protocol for objects that have a read method (e.g., LOBs)."""
|
|
93
|
+
|
|
94
|
+
def read(self, size: "int | None" = None) -> "bytes | str":
|
|
95
|
+
"""Read content from the object."""
|
|
96
|
+
...
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@runtime_checkable
|
|
100
|
+
class AsyncReadableProtocol(Protocol):
|
|
101
|
+
"""Protocol for objects that have an async read method."""
|
|
102
|
+
|
|
103
|
+
async def read(self, size: "int | None" = None) -> "bytes | str":
|
|
104
|
+
"""Read content from the object."""
|
|
105
|
+
...
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@runtime_checkable
|
|
109
|
+
class SupportsArrayProtocol(Protocol):
|
|
110
|
+
"""Protocol for NumPy-like arrays."""
|
|
111
|
+
|
|
112
|
+
dtype: Any
|
|
113
|
+
shape: tuple[int, ...]
|
|
114
|
+
__array__: Any
|
|
115
|
+
|
|
116
|
+
def __len__(self) -> int:
|
|
117
|
+
"""Return the length of the array."""
|
|
118
|
+
...
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@runtime_checkable
|
|
122
|
+
class CursorMetadataProtocol(Protocol):
|
|
123
|
+
"""Protocol for cursor metadata access."""
|
|
124
|
+
|
|
125
|
+
@property
|
|
126
|
+
def description(self) -> "Sequence[Any] | None": ...
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@runtime_checkable
|
|
130
|
+
class NotificationProtocol(Protocol):
|
|
131
|
+
"""Protocol for database event notifications."""
|
|
132
|
+
|
|
133
|
+
channel: str
|
|
134
|
+
payload: str
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@runtime_checkable
|
|
138
|
+
class QueryResultProtocol(Protocol):
|
|
139
|
+
"""Protocol for query execution results."""
|
|
140
|
+
|
|
141
|
+
tag: "str | None"
|
|
142
|
+
status: "str | None"
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
@runtime_checkable
|
|
146
|
+
class HasStatementConfigProtocol(Protocol):
|
|
147
|
+
"""Protocol for objects holding statement configuration."""
|
|
148
|
+
|
|
149
|
+
statement_config: "StatementConfig"
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
@runtime_checkable
|
|
153
|
+
class PipelineCapableProtocol(Protocol):
|
|
154
|
+
"""Protocol for connections supporting pipeline execution."""
|
|
155
|
+
|
|
156
|
+
def run_pipeline(self, pipeline: Any, *, continue_on_error: bool = False) -> Any: ...
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
@runtime_checkable
|
|
160
|
+
class HasStatementTypeProtocol(Protocol):
|
|
161
|
+
"""Protocol for cursors exposing statement_type metadata."""
|
|
162
|
+
|
|
163
|
+
statement_type: "str | None"
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
@runtime_checkable
|
|
167
|
+
class HasTypecodeProtocol(Protocol):
|
|
168
|
+
"""Protocol for array-like objects exposing typecode."""
|
|
169
|
+
|
|
170
|
+
typecode: Any
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@runtime_checkable
|
|
174
|
+
class HasTypecodeSizedProtocol(Protocol):
|
|
175
|
+
"""Protocol for array-like objects exposing typecode and length."""
|
|
176
|
+
|
|
177
|
+
typecode: Any
|
|
178
|
+
|
|
179
|
+
def __len__(self) -> int:
|
|
180
|
+
"""Return the length of the array-like object."""
|
|
181
|
+
...
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
@runtime_checkable
|
|
185
|
+
class HasTypeCodeProtocol(Protocol):
|
|
186
|
+
"""Protocol for objects exposing type_code metadata."""
|
|
187
|
+
|
|
188
|
+
type_code: Any
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
@runtime_checkable
|
|
192
|
+
class HasRowcountProtocol(Protocol):
|
|
193
|
+
"""Protocol for cursors exposing rowcount metadata."""
|
|
194
|
+
|
|
195
|
+
rowcount: int
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
@runtime_checkable
|
|
199
|
+
class HasLastRowIdProtocol(Protocol):
|
|
200
|
+
"""Protocol for cursors exposing lastrowid metadata."""
|
|
201
|
+
|
|
202
|
+
lastrowid: int | None
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
@runtime_checkable
|
|
206
|
+
class HasSqlStateProtocol(Protocol):
|
|
207
|
+
"""Protocol for exceptions exposing sqlstate."""
|
|
208
|
+
|
|
209
|
+
sqlstate: "str | None"
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@runtime_checkable
|
|
213
|
+
class HasSqliteErrorProtocol(Protocol):
|
|
214
|
+
"""Protocol for sqlite errors exposing sqlite error details."""
|
|
215
|
+
|
|
216
|
+
sqlite_errorcode: "int | None"
|
|
217
|
+
sqlite_errorname: "str | None"
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
@runtime_checkable
|
|
221
|
+
class HasValueProtocol(Protocol):
|
|
222
|
+
"""Protocol for wrapper objects exposing a value attribute."""
|
|
223
|
+
|
|
224
|
+
value: Any
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
@runtime_checkable
|
|
228
|
+
class HasErrorsProtocol(Protocol):
|
|
229
|
+
"""Protocol for exceptions exposing structured errors."""
|
|
230
|
+
|
|
231
|
+
errors: "list[dict[str, Any]] | None"
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
@runtime_checkable
|
|
235
|
+
class HasDataProtocol(Protocol):
|
|
236
|
+
"""Protocol for results exposing a data attribute."""
|
|
237
|
+
|
|
238
|
+
data: "Sequence[object] | None"
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
@runtime_checkable
|
|
242
|
+
class HasExecuteProtocol(Protocol):
|
|
243
|
+
"""Protocol for drivers exposing execute method returning data results."""
|
|
244
|
+
|
|
245
|
+
def execute(self, sql: str, *parameters: object, **kwargs: object) -> "HasDataProtocol": ...
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
@runtime_checkable
|
|
249
|
+
class HasNameProtocol(Protocol):
|
|
250
|
+
"""Protocol for objects exposing a __name__ attribute."""
|
|
251
|
+
|
|
252
|
+
__name__: str
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
@runtime_checkable
|
|
256
|
+
class HasNotifiesProtocol(Protocol):
|
|
257
|
+
"""Protocol for asyncpg-like connections exposing notifications."""
|
|
258
|
+
|
|
259
|
+
notifies: Any
|
|
260
|
+
|
|
261
|
+
async def execute(self, query: str, *args: Any, **kwargs: Any) -> Any:
|
|
262
|
+
"""Execute a SQL command on the connection."""
|
|
263
|
+
...
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
@runtime_checkable
|
|
267
|
+
class HasAddListenerProtocol(Protocol):
|
|
268
|
+
"""Protocol for asyncpg-like connections exposing add_listener."""
|
|
269
|
+
|
|
270
|
+
def add_listener(self, channel: str, callback: Any) -> Any: ...
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
@runtime_checkable
|
|
274
|
+
class SupportsJsonTypeProtocol(Protocol):
|
|
275
|
+
"""Protocol for parameter type modules exposing JSON."""
|
|
276
|
+
|
|
277
|
+
JSON: Any
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
@runtime_checkable
|
|
281
|
+
class SpannerParamTypesProtocol(SupportsJsonTypeProtocol, Protocol):
|
|
282
|
+
"""Protocol for Google Spanner param_types module."""
|
|
283
|
+
|
|
284
|
+
BOOL: Any
|
|
285
|
+
INT64: Any
|
|
286
|
+
FLOAT64: Any
|
|
287
|
+
STRING: Any
|
|
288
|
+
BYTES: Any
|
|
289
|
+
TIMESTAMP: Any
|
|
290
|
+
DATE: Any
|
|
291
|
+
Array: "Callable[[Any], Any]"
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
@runtime_checkable
|
|
295
|
+
class SupportsCloseProtocol(Protocol):
|
|
296
|
+
"""Protocol for objects exposing close()."""
|
|
297
|
+
|
|
298
|
+
def close(self) -> None: ...
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
@runtime_checkable
|
|
302
|
+
class SupportsDtypeStrProtocol(Protocol):
|
|
303
|
+
"""Protocol for dtype objects exposing string descriptor."""
|
|
304
|
+
|
|
305
|
+
str: str
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
@runtime_checkable
|
|
309
|
+
class ArrowTableStatsProtocol(Protocol):
|
|
310
|
+
"""Protocol for Arrow objects exposing row and byte counts."""
|
|
311
|
+
|
|
312
|
+
num_rows: int
|
|
313
|
+
nbytes: int
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
@runtime_checkable
|
|
317
|
+
class SpanAttributeProtocol(Protocol):
|
|
318
|
+
"""Protocol for span objects supporting attribute mutation."""
|
|
319
|
+
|
|
320
|
+
def set_attribute(self, key: str, value: Any) -> None: ...
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
@runtime_checkable
|
|
324
|
+
class HasTracerProviderProtocol(Protocol):
|
|
325
|
+
"""Protocol for tracer providers exposing get_tracer."""
|
|
326
|
+
|
|
327
|
+
def get_tracer(self, name: str) -> Any: ...
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
@runtime_checkable
|
|
331
|
+
class AsyncReadBytesProtocol(Protocol):
|
|
332
|
+
"""Protocol for async read_bytes support."""
|
|
333
|
+
|
|
334
|
+
async def read_bytes_async(self, path: "str | Path", **kwargs: Any) -> bytes: ...
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
@runtime_checkable
|
|
338
|
+
class AsyncWriteBytesProtocol(Protocol):
|
|
339
|
+
"""Protocol for async write_bytes support."""
|
|
340
|
+
|
|
341
|
+
async def write_bytes_async(self, path: "str | Path", data: bytes, **kwargs: Any) -> None: ...
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
@runtime_checkable
|
|
345
|
+
class AsyncDeleteProtocol(Protocol):
|
|
346
|
+
"""Protocol for async delete support."""
|
|
347
|
+
|
|
348
|
+
async def delete_async(self, path: "str | Path", **kwargs: Any) -> None: ...
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
@runtime_checkable
|
|
352
|
+
class StatementProtocol(Protocol):
|
|
353
|
+
"""Protocol for statement attribute access."""
|
|
354
|
+
|
|
355
|
+
@property
|
|
356
|
+
def raw_sql(self) -> "str | None": ...
|
|
357
|
+
|
|
358
|
+
@property
|
|
359
|
+
def sql(self) -> str: ...
|
|
360
|
+
|
|
361
|
+
@property
|
|
362
|
+
def operation_type(self) -> str: ...
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
@runtime_checkable
|
|
366
|
+
class WithMethodProtocol(Protocol):
|
|
367
|
+
"""Protocol for objects with a with_ method (SQLGlot expressions)."""
|
|
368
|
+
|
|
369
|
+
def with_(self, *args: Any, **kwargs: Any) -> Any:
|
|
370
|
+
"""Add WITH clause to expression."""
|
|
371
|
+
...
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
@runtime_checkable
|
|
375
|
+
class HasWhereProtocol(Protocol):
|
|
376
|
+
"""Protocol for SQL expressions that support WHERE clauses."""
|
|
377
|
+
|
|
378
|
+
def where(self, *args: Any, **kwargs: Any) -> Any:
|
|
379
|
+
"""Add WHERE clause to expression."""
|
|
380
|
+
...
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
@runtime_checkable
|
|
384
|
+
class DictProtocol(Protocol):
|
|
385
|
+
"""Protocol for objects with a __dict__ attribute."""
|
|
386
|
+
|
|
387
|
+
__dict__: dict[str, Any]
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
@runtime_checkable
|
|
391
|
+
class HasConfigProtocol(Protocol):
|
|
392
|
+
"""Protocol for wrapper objects exposing a config attribute."""
|
|
393
|
+
|
|
394
|
+
config: Any
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
@runtime_checkable
|
|
398
|
+
class HasConnectionConfigProtocol(Protocol):
|
|
399
|
+
"""Protocol for configs exposing connection_config mapping."""
|
|
400
|
+
|
|
401
|
+
connection_config: "Mapping[str, object]"
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
@runtime_checkable
|
|
405
|
+
class HasDatabaseUrlAndBindKeyProtocol(Protocol):
|
|
406
|
+
"""Protocol for configs exposing database_url and bind_key."""
|
|
407
|
+
|
|
408
|
+
database_url: str
|
|
409
|
+
bind_key: "str | None"
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
@runtime_checkable
|
|
413
|
+
class HasExtensionConfigProtocol(Protocol):
|
|
414
|
+
"""Protocol for configs exposing extension_config mapping."""
|
|
415
|
+
|
|
416
|
+
@property
|
|
417
|
+
def extension_config(self) -> "ExtensionConfigs":
|
|
418
|
+
"""Return extension configuration mapping."""
|
|
419
|
+
...
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
@runtime_checkable
|
|
423
|
+
class HasFieldNameProtocol(Protocol):
|
|
424
|
+
"""Protocol for objects exposing field_name attribute."""
|
|
425
|
+
|
|
426
|
+
field_name: Any
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
@runtime_checkable
|
|
430
|
+
class HasFilterAttributesProtocol(Protocol):
|
|
431
|
+
"""Protocol for filter-like objects exposing field attributes."""
|
|
432
|
+
|
|
433
|
+
field_name: Any
|
|
434
|
+
operation: Any
|
|
435
|
+
value: Any
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
@runtime_checkable
|
|
439
|
+
class HasGetDataProtocol(Protocol):
|
|
440
|
+
"""Protocol for results exposing get_data()."""
|
|
441
|
+
|
|
442
|
+
def get_data(self) -> Any: ...
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
@runtime_checkable
|
|
446
|
+
class ObjectStoreProtocol(Protocol):
|
|
447
|
+
"""Protocol for object storage operations."""
|
|
448
|
+
|
|
449
|
+
protocol: str
|
|
450
|
+
backend_type: str
|
|
451
|
+
|
|
452
|
+
def __init__(self, uri: str, **kwargs: Any) -> None:
|
|
453
|
+
return
|
|
454
|
+
|
|
455
|
+
def read_bytes(self, path: "str | Path", **kwargs: Any) -> bytes:
|
|
456
|
+
"""Read bytes from an object."""
|
|
457
|
+
return b""
|
|
458
|
+
|
|
459
|
+
def write_bytes(self, path: "str | Path", data: bytes, **kwargs: Any) -> None:
|
|
460
|
+
"""Write bytes to an object."""
|
|
461
|
+
return
|
|
462
|
+
|
|
463
|
+
def read_text(self, path: "str | Path", encoding: str = "utf-8", **kwargs: Any) -> str:
|
|
464
|
+
"""Read text from an object."""
|
|
465
|
+
return ""
|
|
466
|
+
|
|
467
|
+
def write_text(self, path: "str | Path", data: str, encoding: str = "utf-8", **kwargs: Any) -> None:
|
|
468
|
+
"""Write text to an object."""
|
|
469
|
+
return
|
|
470
|
+
|
|
471
|
+
def exists(self, path: "str | Path", **kwargs: Any) -> bool:
|
|
472
|
+
"""Check if an object exists."""
|
|
473
|
+
return False
|
|
474
|
+
|
|
475
|
+
def delete(self, path: "str | Path", **kwargs: Any) -> None:
|
|
476
|
+
"""Delete an object."""
|
|
477
|
+
return
|
|
478
|
+
|
|
479
|
+
def copy(self, source: "str | Path", destination: "str | Path", **kwargs: Any) -> None:
|
|
480
|
+
"""Copy an object."""
|
|
481
|
+
return
|
|
482
|
+
|
|
483
|
+
def move(self, source: "str | Path", destination: "str | Path", **kwargs: Any) -> None:
|
|
484
|
+
"""Move an object."""
|
|
485
|
+
return
|
|
486
|
+
|
|
487
|
+
def list_objects(self, prefix: str = "", recursive: bool = True, **kwargs: Any) -> list[str]:
|
|
488
|
+
"""List objects with optional prefix."""
|
|
489
|
+
return []
|
|
490
|
+
|
|
491
|
+
def glob(self, pattern: str, **kwargs: Any) -> list[str]:
|
|
492
|
+
"""Find objects matching a glob pattern."""
|
|
493
|
+
return []
|
|
494
|
+
|
|
495
|
+
def is_object(self, path: "str | Path") -> bool:
|
|
496
|
+
"""Check if path points to an object."""
|
|
497
|
+
return False
|
|
498
|
+
|
|
499
|
+
def is_path(self, path: "str | Path") -> bool:
|
|
500
|
+
"""Check if path points to a prefix (directory-like)."""
|
|
501
|
+
return False
|
|
502
|
+
|
|
503
|
+
def get_metadata(self, path: "str | Path", **kwargs: Any) -> dict[str, object]:
|
|
504
|
+
"""Get object metadata."""
|
|
505
|
+
return {}
|
|
506
|
+
|
|
507
|
+
def read_arrow(self, path: "str | Path", **kwargs: Any) -> "ArrowTable":
|
|
508
|
+
"""Read an Arrow table from storage."""
|
|
509
|
+
msg = "Arrow reading not implemented"
|
|
510
|
+
raise NotImplementedError(msg)
|
|
511
|
+
|
|
512
|
+
def write_arrow(self, path: "str | Path", table: "ArrowTable", **kwargs: Any) -> None:
|
|
513
|
+
"""Write an Arrow table to storage."""
|
|
514
|
+
msg = "Arrow writing not implemented"
|
|
515
|
+
raise NotImplementedError(msg)
|
|
516
|
+
|
|
517
|
+
def stream_arrow(self, pattern: str, **kwargs: Any) -> "Iterator[ArrowRecordBatch]":
|
|
518
|
+
"""Stream Arrow record batches from matching objects."""
|
|
519
|
+
msg = "Arrow streaming not implemented"
|
|
520
|
+
raise NotImplementedError(msg)
|
|
521
|
+
|
|
522
|
+
def stream_read(self, path: "str | Path", chunk_size: "int | None" = None, **kwargs: Any) -> "Iterator[bytes]":
|
|
523
|
+
"""Stream bytes from an object."""
|
|
524
|
+
msg = "Stream reading not implemented"
|
|
525
|
+
raise NotImplementedError(msg)
|
|
526
|
+
|
|
527
|
+
async def read_bytes_async(self, path: "str | Path", **kwargs: Any) -> bytes:
|
|
528
|
+
"""Async read bytes from an object."""
|
|
529
|
+
msg = "Async operations not implemented"
|
|
530
|
+
raise NotImplementedError(msg)
|
|
531
|
+
|
|
532
|
+
async def write_bytes_async(self, path: "str | Path", data: bytes, **kwargs: Any) -> None:
|
|
533
|
+
"""Async write bytes to an object."""
|
|
534
|
+
msg = "Async operations not implemented"
|
|
535
|
+
raise NotImplementedError(msg)
|
|
536
|
+
|
|
537
|
+
async def read_text_async(self, path: "str | Path", encoding: str = "utf-8", **kwargs: Any) -> str:
|
|
538
|
+
"""Async read text from an object."""
|
|
539
|
+
msg = "Async operations not implemented"
|
|
540
|
+
raise NotImplementedError(msg)
|
|
541
|
+
|
|
542
|
+
async def write_text_async(self, path: "str | Path", data: str, encoding: str = "utf-8", **kwargs: Any) -> None:
|
|
543
|
+
"""Async write text to an object."""
|
|
544
|
+
msg = "Async operations not implemented"
|
|
545
|
+
raise NotImplementedError(msg)
|
|
546
|
+
|
|
547
|
+
async def stream_read_async(
|
|
548
|
+
self, path: "str | Path", chunk_size: "int | None" = None, **kwargs: Any
|
|
549
|
+
) -> "AsyncIterator[bytes]":
|
|
550
|
+
"""Stream bytes from an object asynchronously."""
|
|
551
|
+
msg = "Async stream reading not implemented"
|
|
552
|
+
raise NotImplementedError(msg)
|
|
553
|
+
|
|
554
|
+
async def exists_async(self, path: "str | Path", **kwargs: Any) -> bool:
|
|
555
|
+
"""Async check if an object exists."""
|
|
556
|
+
msg = "Async operations not implemented"
|
|
557
|
+
raise NotImplementedError(msg)
|
|
558
|
+
|
|
559
|
+
async def delete_async(self, path: "str | Path", **kwargs: Any) -> None:
|
|
560
|
+
"""Async delete an object."""
|
|
561
|
+
msg = "Async operations not implemented"
|
|
562
|
+
raise NotImplementedError(msg)
|
|
563
|
+
|
|
564
|
+
async def list_objects_async(self, prefix: str = "", recursive: bool = True, **kwargs: Any) -> list[str]:
|
|
565
|
+
"""Async list objects with optional prefix."""
|
|
566
|
+
msg = "Async operations not implemented"
|
|
567
|
+
raise NotImplementedError(msg)
|
|
568
|
+
|
|
569
|
+
async def copy_async(self, source: "str | Path", destination: "str | Path", **kwargs: Any) -> None:
|
|
570
|
+
"""Async copy an object."""
|
|
571
|
+
msg = "Async operations not implemented"
|
|
572
|
+
raise NotImplementedError(msg)
|
|
573
|
+
|
|
574
|
+
async def move_async(self, source: "str | Path", destination: "str | Path", **kwargs: Any) -> None:
|
|
575
|
+
"""Async move an object."""
|
|
576
|
+
msg = "Async operations not implemented"
|
|
577
|
+
raise NotImplementedError(msg)
|
|
578
|
+
|
|
579
|
+
async def get_metadata_async(self, path: "str | Path", **kwargs: Any) -> dict[str, object]:
|
|
580
|
+
"""Async get object metadata."""
|
|
581
|
+
msg = "Async operations not implemented"
|
|
582
|
+
raise NotImplementedError(msg)
|
|
583
|
+
|
|
584
|
+
async def read_arrow_async(self, path: "str | Path", **kwargs: Any) -> "ArrowTable":
|
|
585
|
+
"""Async read an Arrow table from storage."""
|
|
586
|
+
msg = "Async arrow reading not implemented"
|
|
587
|
+
raise NotImplementedError(msg)
|
|
588
|
+
|
|
589
|
+
async def write_arrow_async(self, path: "str | Path", table: "ArrowTable", **kwargs: Any) -> None:
|
|
590
|
+
"""Async write an Arrow table to storage."""
|
|
591
|
+
msg = "Async arrow writing not implemented"
|
|
592
|
+
raise NotImplementedError(msg)
|
|
593
|
+
|
|
594
|
+
def stream_arrow_async(self, pattern: str, **kwargs: Any) -> "AsyncIterator[ArrowRecordBatch]":
|
|
595
|
+
"""Async stream Arrow record batches from matching objects."""
|
|
596
|
+
msg = "Async arrow streaming not implemented"
|
|
597
|
+
raise NotImplementedError(msg)
|
|
598
|
+
|
|
599
|
+
@property
|
|
600
|
+
def supports_signing(self) -> bool:
|
|
601
|
+
"""Whether this backend supports URL signing.
|
|
602
|
+
|
|
603
|
+
Returns:
|
|
604
|
+
True if the backend supports generating signed URLs, False otherwise.
|
|
605
|
+
Only S3, GCS, and Azure backends via obstore support signing.
|
|
606
|
+
"""
|
|
607
|
+
return False
|
|
608
|
+
|
|
609
|
+
@overload
|
|
610
|
+
def sign_sync(self, paths: str, expires_in: int = 3600, for_upload: bool = False) -> str: ...
|
|
611
|
+
|
|
612
|
+
@overload
|
|
613
|
+
def sign_sync(self, paths: list[str], expires_in: int = 3600, for_upload: bool = False) -> list[str]: ...
|
|
614
|
+
|
|
615
|
+
def sign_sync(
|
|
616
|
+
self, paths: "str | list[str]", expires_in: int = 3600, for_upload: bool = False
|
|
617
|
+
) -> "str | list[str]":
|
|
618
|
+
"""Generate signed URL(s) for object(s).
|
|
619
|
+
|
|
620
|
+
Args:
|
|
621
|
+
paths: Single object path or list of paths to sign.
|
|
622
|
+
expires_in: URL expiration time in seconds (default: 3600, max: 604800 = 7 days).
|
|
623
|
+
for_upload: Whether the URL is for upload (PUT) vs download (GET).
|
|
624
|
+
|
|
625
|
+
Returns:
|
|
626
|
+
Single signed URL string if paths is a string, or list of signed URLs
|
|
627
|
+
if paths is a list. Preserves input type for convenience.
|
|
628
|
+
|
|
629
|
+
Raises:
|
|
630
|
+
NotImplementedError: If the backend does not support URL signing.
|
|
631
|
+
"""
|
|
632
|
+
msg = "URL signing not supported by this backend"
|
|
633
|
+
raise NotImplementedError(msg)
|
|
634
|
+
|
|
635
|
+
@overload
|
|
636
|
+
async def sign_async(self, paths: str, expires_in: int = 3600, for_upload: bool = False) -> str: ...
|
|
637
|
+
|
|
638
|
+
@overload
|
|
639
|
+
async def sign_async(self, paths: list[str], expires_in: int = 3600, for_upload: bool = False) -> list[str]: ...
|
|
640
|
+
|
|
641
|
+
async def sign_async(
|
|
642
|
+
self, paths: "str | list[str]", expires_in: int = 3600, for_upload: bool = False
|
|
643
|
+
) -> "str | list[str]":
|
|
644
|
+
"""Generate signed URL(s) asynchronously.
|
|
645
|
+
|
|
646
|
+
Args:
|
|
647
|
+
paths: Single object path or list of paths to sign.
|
|
648
|
+
expires_in: URL expiration time in seconds (default: 3600, max: 604800 = 7 days).
|
|
649
|
+
for_upload: Whether the URL is for upload (PUT) vs download (GET).
|
|
650
|
+
|
|
651
|
+
Returns:
|
|
652
|
+
Single signed URL string if paths is a string, or list of signed URLs
|
|
653
|
+
if paths is a list. Preserves input type for convenience.
|
|
654
|
+
|
|
655
|
+
Raises:
|
|
656
|
+
NotImplementedError: If the backend does not support URL signing.
|
|
657
|
+
"""
|
|
658
|
+
msg = "URL signing not supported by this backend"
|
|
659
|
+
raise NotImplementedError(msg)
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
@runtime_checkable
|
|
663
|
+
class HasSQLGlotExpressionProtocol(Protocol):
|
|
664
|
+
"""Protocol for objects with a sqlglot_expression property."""
|
|
665
|
+
|
|
666
|
+
@property
|
|
667
|
+
def sqlglot_expression(self) -> "exp.Expression | None":
|
|
668
|
+
"""Return the SQLGlot expression for this object."""
|
|
669
|
+
...
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
@runtime_checkable
|
|
673
|
+
class HasParameterBuilderProtocol(Protocol):
|
|
674
|
+
"""Protocol for objects that can add parameters and build queries."""
|
|
675
|
+
|
|
676
|
+
@property
|
|
677
|
+
def parameters(self) -> dict[str, Any]:
|
|
678
|
+
"""Return the current parameters dictionary."""
|
|
679
|
+
...
|
|
680
|
+
|
|
681
|
+
def add_parameter(self, value: Any, name: "str | None" = None) -> tuple[Any, str]:
|
|
682
|
+
"""Add a parameter to the builder."""
|
|
683
|
+
...
|
|
684
|
+
|
|
685
|
+
def get_expression(self) -> "exp.Expression | None":
|
|
686
|
+
"""Return the underlying SQLGlot expression."""
|
|
687
|
+
...
|
|
688
|
+
|
|
689
|
+
def set_expression(self, expression: "exp.Expression") -> None:
|
|
690
|
+
"""Replace the underlying SQLGlot expression."""
|
|
691
|
+
...
|
|
692
|
+
|
|
693
|
+
def build(self, dialect: Any = None) -> Any:
|
|
694
|
+
"""Build the SQL query and return a BuiltQuery-like object."""
|
|
695
|
+
...
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
@runtime_checkable
|
|
699
|
+
class HasExpressionProtocol(Protocol):
|
|
700
|
+
"""Protocol for objects with an _expression attribute."""
|
|
701
|
+
|
|
702
|
+
_expression: "exp.Expression | None"
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
@runtime_checkable
|
|
706
|
+
class SQLBuilderProtocol(Protocol):
|
|
707
|
+
"""Protocol for SQL query builders."""
|
|
708
|
+
|
|
709
|
+
_expression: "exp.Expression | None"
|
|
710
|
+
_parameters: dict[str, Any]
|
|
711
|
+
_parameter_counter: int
|
|
712
|
+
_parameter_name_counters: dict[str, int]
|
|
713
|
+
_columns: Any # Optional attribute for some builders
|
|
714
|
+
_with_ctes: Any # Optional attribute for some builders
|
|
715
|
+
dialect: Any
|
|
716
|
+
dialect_name: "str | None"
|
|
717
|
+
|
|
718
|
+
@property
|
|
719
|
+
def parameters(self) -> dict[str, Any]:
|
|
720
|
+
"""Public access to query parameters."""
|
|
721
|
+
...
|
|
722
|
+
|
|
723
|
+
def get_expression(self) -> "exp.Expression | None":
|
|
724
|
+
"""Return the current SQLGlot expression."""
|
|
725
|
+
...
|
|
726
|
+
|
|
727
|
+
def add_parameter(self, value: Any, name: "str | None" = None) -> tuple[Any, str]:
|
|
728
|
+
"""Add a parameter to the builder."""
|
|
729
|
+
...
|
|
730
|
+
|
|
731
|
+
def _generate_unique_parameter_name(self, base_name: str) -> str:
|
|
732
|
+
"""Generate a unique parameter name."""
|
|
733
|
+
...
|
|
734
|
+
|
|
735
|
+
def _create_placeholder(self, value: Any, base_name: str) -> "tuple[exp.Placeholder, str]":
|
|
736
|
+
"""Create placeholder expression with bound parameter."""
|
|
737
|
+
...
|
|
738
|
+
|
|
739
|
+
def create_placeholder(self, value: Any, base_name: str) -> "tuple[exp.Placeholder, str]":
|
|
740
|
+
"""Create placeholder expression with bound parameter (public)."""
|
|
741
|
+
...
|
|
742
|
+
|
|
743
|
+
def _parameterize_expression(self, expression: "exp.Expression") -> "exp.Expression":
|
|
744
|
+
"""Replace literal values in an expression with bound parameters."""
|
|
745
|
+
...
|
|
746
|
+
|
|
747
|
+
def build(self) -> "exp.Expression | Any":
|
|
748
|
+
"""Build and return the final expression."""
|
|
749
|
+
...
|
|
750
|
+
|
|
751
|
+
def _merge_sql_object_parameters(self, sql_obj: Any) -> None:
|
|
752
|
+
"""Merge parameters from SQL objects into the builder."""
|
|
753
|
+
...
|
|
754
|
+
|
|
755
|
+
def _build_final_expression(self, *, copy: bool = False) -> "exp.Expression":
|
|
756
|
+
"""Return the expression with attached CTEs."""
|
|
757
|
+
...
|
|
758
|
+
|
|
759
|
+
def _spawn_like_self(self) -> "Self":
|
|
760
|
+
"""Create a new builder with matching configuration."""
|
|
761
|
+
...
|
|
762
|
+
|
|
763
|
+
def set_expression(self, expression: "exp.Expression") -> None:
|
|
764
|
+
"""Replace the underlying SQLGlot expression."""
|
|
765
|
+
...
|
|
766
|
+
|
|
767
|
+
def generate_unique_parameter_name(self, base_name: str) -> str:
|
|
768
|
+
"""Generate a unique parameter name exposed via public API."""
|
|
769
|
+
...
|
|
770
|
+
|
|
771
|
+
def build_static_expression(
|
|
772
|
+
self,
|
|
773
|
+
expression: "exp.Expression | None" = None,
|
|
774
|
+
parameters: dict[str, Any] | None = None,
|
|
775
|
+
*,
|
|
776
|
+
cache_key: str | None = None,
|
|
777
|
+
expression_factory: "Callable[[], exp.Expression] | None" = None,
|
|
778
|
+
copy: bool = True,
|
|
779
|
+
optimize_expression: bool | None = None,
|
|
780
|
+
dialect: "DialectType | None" = None,
|
|
781
|
+
) -> Any:
|
|
782
|
+
"""Compile a pre-built expression with optional caching and parameters."""
|
|
783
|
+
...
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
@runtime_checkable
|
|
787
|
+
class SupportsArrowResults(Protocol):
|
|
788
|
+
"""Protocol for adapters that support Arrow result format.
|
|
789
|
+
|
|
790
|
+
Adapters implementing this protocol can return query results in Apache Arrow
|
|
791
|
+
format via the select_to_arrow() method, enabling zero-copy data transfer and
|
|
792
|
+
efficient integration with data science tools.
|
|
793
|
+
"""
|
|
794
|
+
|
|
795
|
+
def select_to_arrow(
|
|
796
|
+
self,
|
|
797
|
+
statement: Any,
|
|
798
|
+
/,
|
|
799
|
+
*parameters: Any,
|
|
800
|
+
statement_config: Any | None = None,
|
|
801
|
+
return_format: str = "table",
|
|
802
|
+
native_only: bool = False,
|
|
803
|
+
batch_size: int | None = None,
|
|
804
|
+
arrow_schema: Any | None = None,
|
|
805
|
+
**kwargs: Any,
|
|
806
|
+
) -> "ArrowTable | ArrowRecordBatch":
|
|
807
|
+
"""Execute query and return results as Apache Arrow Table or RecordBatch.
|
|
808
|
+
|
|
809
|
+
Args:
|
|
810
|
+
statement: SQL statement to execute.
|
|
811
|
+
*parameters: Query parameters and filters.
|
|
812
|
+
statement_config: Optional statement configuration override.
|
|
813
|
+
return_format: Output format - "table", "reader", or "batches".
|
|
814
|
+
native_only: If True, raise error when native Arrow path unavailable.
|
|
815
|
+
batch_size: Chunk size for streaming modes.
|
|
816
|
+
arrow_schema: Optional target Arrow schema for type casting.
|
|
817
|
+
**kwargs: Additional keyword arguments.
|
|
818
|
+
|
|
819
|
+
Returns:
|
|
820
|
+
ArrowResult containing Arrow data.
|
|
821
|
+
"""
|
|
822
|
+
...
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
@runtime_checkable
|
|
826
|
+
class HasExpressionAndSQLProtocol(Protocol):
|
|
827
|
+
"""Protocol for objects with both expression and sql attributes (like SQL class)."""
|
|
828
|
+
|
|
829
|
+
expression: Any
|
|
830
|
+
sql: str
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
@runtime_checkable
|
|
834
|
+
class HasExpressionAndParametersProtocol(Protocol):
|
|
835
|
+
"""Protocol for objects with both expression and parameters attributes."""
|
|
836
|
+
|
|
837
|
+
expression: Any
|
|
838
|
+
parameters: Any
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
@runtime_checkable
|
|
842
|
+
class HasStatementConfigFactoryProtocol(Protocol):
|
|
843
|
+
"""Protocol for objects that can create a StatementConfig.
|
|
844
|
+
|
|
845
|
+
Used for config objects that have a factory method to create statement configs.
|
|
846
|
+
"""
|
|
847
|
+
|
|
848
|
+
def _create_statement_config(self) -> "StatementConfig":
|
|
849
|
+
"""Create a new StatementConfig instance."""
|
|
850
|
+
...
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
@runtime_checkable
|
|
854
|
+
class HasMigrationConfigProtocol(Protocol):
|
|
855
|
+
"""Protocol for database configurations that support migrations.
|
|
856
|
+
|
|
857
|
+
Used to check if a config object has migration_config attribute.
|
|
858
|
+
"""
|
|
859
|
+
|
|
860
|
+
migration_config: "Mapping[str, Any] | None"
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
class SyncDataDictionaryProtocol(Protocol):
|
|
864
|
+
"""Protocol for sync data dictionary implementations."""
|
|
865
|
+
|
|
866
|
+
dialect: str
|
|
867
|
+
|
|
868
|
+
def get_version(self, driver: Any) -> "VersionInfo | None": ...
|
|
869
|
+
|
|
870
|
+
def get_feature_flag(self, driver: Any, feature: str) -> bool: ...
|
|
871
|
+
|
|
872
|
+
def get_optimal_type(self, driver: Any, type_category: str) -> str: ...
|
|
873
|
+
|
|
874
|
+
def get_tables(self, driver: Any, schema: "str | None" = None) -> "list[TableMetadata]": ...
|
|
875
|
+
|
|
876
|
+
def get_columns(
|
|
877
|
+
self, driver: Any, table: "str | None" = None, schema: "str | None" = None
|
|
878
|
+
) -> "list[ColumnMetadata]": ...
|
|
879
|
+
|
|
880
|
+
def get_indexes(
|
|
881
|
+
self, driver: Any, table: "str | None" = None, schema: "str | None" = None
|
|
882
|
+
) -> "list[IndexMetadata]": ...
|
|
883
|
+
|
|
884
|
+
def get_foreign_keys(
|
|
885
|
+
self, driver: Any, table: "str | None" = None, schema: "str | None" = None
|
|
886
|
+
) -> "list[ForeignKeyMetadata]": ...
|
|
887
|
+
|
|
888
|
+
def list_available_features(self) -> "list[str]": ...
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
class AsyncDataDictionaryProtocol(Protocol):
|
|
892
|
+
"""Protocol for async data dictionary implementations."""
|
|
893
|
+
|
|
894
|
+
dialect: str
|
|
895
|
+
|
|
896
|
+
async def get_version(self, driver: Any) -> "VersionInfo | None": ...
|
|
897
|
+
|
|
898
|
+
async def get_feature_flag(self, driver: Any, feature: str) -> bool: ...
|
|
899
|
+
|
|
900
|
+
async def get_optimal_type(self, driver: Any, type_category: str) -> str: ...
|
|
901
|
+
|
|
902
|
+
async def get_tables(self, driver: Any, schema: "str | None" = None) -> "list[TableMetadata]": ...
|
|
903
|
+
|
|
904
|
+
async def get_columns(
|
|
905
|
+
self, driver: Any, table: "str | None" = None, schema: "str | None" = None
|
|
906
|
+
) -> "list[ColumnMetadata]": ...
|
|
907
|
+
|
|
908
|
+
async def get_indexes(
|
|
909
|
+
self, driver: Any, table: "str | None" = None, schema: "str | None" = None
|
|
910
|
+
) -> "list[IndexMetadata]": ...
|
|
911
|
+
|
|
912
|
+
async def get_foreign_keys(
|
|
913
|
+
self, driver: Any, table: "str | None" = None, schema: "str | None" = None
|
|
914
|
+
) -> "list[ForeignKeyMetadata]": ...
|
|
915
|
+
|
|
916
|
+
def list_available_features(self) -> "list[str]": ...
|