sqlspec 0.47.0__cp314-cp314-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- f68e0789eb443ecb1c2c__mypyc.cp314-win_amd64.pyd +0 -0
- sqlspec/__init__.py +167 -0
- sqlspec/__main__.py +12 -0
- sqlspec/__metadata__.py +14 -0
- sqlspec/_typing.py +714 -0
- sqlspec/adapters/__init__.py +0 -0
- sqlspec/adapters/adbc/__init__.py +13 -0
- sqlspec/adapters/adbc/_typing.py +106 -0
- sqlspec/adapters/adbc/adk/__init__.py +5 -0
- sqlspec/adapters/adbc/adk/store.py +1280 -0
- sqlspec/adapters/adbc/config.py +378 -0
- sqlspec/adapters/adbc/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/adbc/core.py +922 -0
- sqlspec/adapters/adbc/data_dictionary.py +339 -0
- sqlspec/adapters/adbc/driver.py +534 -0
- sqlspec/adapters/adbc/events/__init__.py +5 -0
- sqlspec/adapters/adbc/events/store.py +285 -0
- sqlspec/adapters/adbc/litestar/__init__.py +5 -0
- sqlspec/adapters/adbc/litestar/store.py +534 -0
- sqlspec/adapters/adbc/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/adbc/type_converter.py +142 -0
- sqlspec/adapters/aiomysql/__init__.py +21 -0
- sqlspec/adapters/aiomysql/_typing.py +137 -0
- sqlspec/adapters/aiomysql/adk/__init__.py +5 -0
- sqlspec/adapters/aiomysql/adk/store.py +678 -0
- sqlspec/adapters/aiomysql/config.py +305 -0
- sqlspec/adapters/aiomysql/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/aiomysql/core.py +536 -0
- sqlspec/adapters/aiomysql/data_dictionary.py +121 -0
- sqlspec/adapters/aiomysql/driver.py +386 -0
- sqlspec/adapters/aiomysql/events/__init__.py +5 -0
- sqlspec/adapters/aiomysql/events/store.py +104 -0
- sqlspec/adapters/aiomysql/litestar/__init__.py +5 -0
- sqlspec/adapters/aiomysql/litestar/store.py +314 -0
- sqlspec/adapters/aiosqlite/__init__.py +26 -0
- sqlspec/adapters/aiosqlite/_typing.py +109 -0
- sqlspec/adapters/aiosqlite/adk/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/adk/store.py +829 -0
- sqlspec/adapters/aiosqlite/config.py +315 -0
- sqlspec/adapters/aiosqlite/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/aiosqlite/core.py +315 -0
- sqlspec/adapters/aiosqlite/data_dictionary.py +202 -0
- sqlspec/adapters/aiosqlite/driver.py +311 -0
- sqlspec/adapters/aiosqlite/events/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/events/store.py +20 -0
- sqlspec/adapters/aiosqlite/litestar/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/litestar/store.py +279 -0
- sqlspec/adapters/aiosqlite/pool.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/aiosqlite/pool.py +734 -0
- sqlspec/adapters/asyncmy/__init__.py +21 -0
- sqlspec/adapters/asyncmy/_typing.py +113 -0
- sqlspec/adapters/asyncmy/adk/__init__.py +5 -0
- sqlspec/adapters/asyncmy/adk/store.py +644 -0
- sqlspec/adapters/asyncmy/config.py +307 -0
- sqlspec/adapters/asyncmy/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/asyncmy/core.py +538 -0
- sqlspec/adapters/asyncmy/data_dictionary.py +122 -0
- sqlspec/adapters/asyncmy/driver.py +391 -0
- sqlspec/adapters/asyncmy/events/__init__.py +5 -0
- sqlspec/adapters/asyncmy/events/store.py +104 -0
- sqlspec/adapters/asyncmy/litestar/__init__.py +5 -0
- sqlspec/adapters/asyncmy/litestar/store.py +296 -0
- sqlspec/adapters/asyncpg/__init__.py +26 -0
- sqlspec/adapters/asyncpg/_typing.py +103 -0
- sqlspec/adapters/asyncpg/adk/__init__.py +5 -0
- sqlspec/adapters/asyncpg/adk/store.py +483 -0
- sqlspec/adapters/asyncpg/config.py +575 -0
- sqlspec/adapters/asyncpg/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/asyncpg/core.py +480 -0
- sqlspec/adapters/asyncpg/data_dictionary.py +157 -0
- sqlspec/adapters/asyncpg/driver.py +487 -0
- sqlspec/adapters/asyncpg/events/__init__.py +6 -0
- sqlspec/adapters/asyncpg/events/_hub.py +181 -0
- sqlspec/adapters/asyncpg/events/backend.py +210 -0
- sqlspec/adapters/asyncpg/events/store.py +40 -0
- sqlspec/adapters/asyncpg/litestar/__init__.py +5 -0
- sqlspec/adapters/asyncpg/litestar/store.py +251 -0
- sqlspec/adapters/bigquery/__init__.py +15 -0
- sqlspec/adapters/bigquery/_typing.py +108 -0
- sqlspec/adapters/bigquery/config.py +362 -0
- sqlspec/adapters/bigquery/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/bigquery/core.py +768 -0
- sqlspec/adapters/bigquery/data_dictionary.py +120 -0
- sqlspec/adapters/bigquery/driver.py +542 -0
- sqlspec/adapters/bigquery/events/__init__.py +5 -0
- sqlspec/adapters/bigquery/events/store.py +139 -0
- sqlspec/adapters/bigquery/litestar/__init__.py +5 -0
- sqlspec/adapters/bigquery/litestar/store.py +325 -0
- sqlspec/adapters/bigquery/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/bigquery/type_converter.py +107 -0
- sqlspec/adapters/cockroach_asyncpg/__init__.py +26 -0
- sqlspec/adapters/cockroach_asyncpg/_typing.py +73 -0
- sqlspec/adapters/cockroach_asyncpg/adk/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/adk/store.py +465 -0
- sqlspec/adapters/cockroach_asyncpg/config.py +248 -0
- sqlspec/adapters/cockroach_asyncpg/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/cockroach_asyncpg/core.py +55 -0
- sqlspec/adapters/cockroach_asyncpg/data_dictionary.py +110 -0
- sqlspec/adapters/cockroach_asyncpg/driver.py +142 -0
- sqlspec/adapters/cockroach_asyncpg/events/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/events/store.py +20 -0
- sqlspec/adapters/cockroach_asyncpg/litestar/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/litestar/store.py +142 -0
- sqlspec/adapters/cockroach_psycopg/__init__.py +39 -0
- sqlspec/adapters/cockroach_psycopg/_typing.py +137 -0
- sqlspec/adapters/cockroach_psycopg/adk/__init__.py +13 -0
- sqlspec/adapters/cockroach_psycopg/adk/store.py +1039 -0
- sqlspec/adapters/cockroach_psycopg/config.py +511 -0
- sqlspec/adapters/cockroach_psycopg/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/cockroach_psycopg/core.py +63 -0
- sqlspec/adapters/cockroach_psycopg/data_dictionary.py +220 -0
- sqlspec/adapters/cockroach_psycopg/driver.py +273 -0
- sqlspec/adapters/cockroach_psycopg/events/__init__.py +6 -0
- sqlspec/adapters/cockroach_psycopg/events/store.py +34 -0
- sqlspec/adapters/cockroach_psycopg/litestar/__init__.py +3 -0
- sqlspec/adapters/cockroach_psycopg/litestar/store.py +327 -0
- sqlspec/adapters/duckdb/__init__.py +29 -0
- sqlspec/adapters/duckdb/_typing.py +104 -0
- sqlspec/adapters/duckdb/adk/__init__.py +14 -0
- sqlspec/adapters/duckdb/adk/store.py +935 -0
- sqlspec/adapters/duckdb/config.py +386 -0
- sqlspec/adapters/duckdb/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/duckdb/core.py +332 -0
- sqlspec/adapters/duckdb/data_dictionary.py +140 -0
- sqlspec/adapters/duckdb/driver.py +426 -0
- sqlspec/adapters/duckdb/events/__init__.py +5 -0
- sqlspec/adapters/duckdb/events/store.py +57 -0
- sqlspec/adapters/duckdb/litestar/__init__.py +5 -0
- sqlspec/adapters/duckdb/litestar/store.py +330 -0
- sqlspec/adapters/duckdb/pool.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/duckdb/pool.py +350 -0
- sqlspec/adapters/duckdb/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/duckdb/type_converter.py +118 -0
- sqlspec/adapters/mysqlconnector/__init__.py +39 -0
- sqlspec/adapters/mysqlconnector/_typing.py +186 -0
- sqlspec/adapters/mysqlconnector/adk/__init__.py +15 -0
- sqlspec/adapters/mysqlconnector/adk/store.py +1183 -0
- sqlspec/adapters/mysqlconnector/config.py +421 -0
- sqlspec/adapters/mysqlconnector/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/mysqlconnector/core.py +472 -0
- sqlspec/adapters/mysqlconnector/data_dictionary.py +230 -0
- sqlspec/adapters/mysqlconnector/driver.py +516 -0
- sqlspec/adapters/mysqlconnector/events/__init__.py +8 -0
- sqlspec/adapters/mysqlconnector/events/store.py +98 -0
- sqlspec/adapters/mysqlconnector/litestar/__init__.py +5 -0
- sqlspec/adapters/mysqlconnector/litestar/store.py +426 -0
- sqlspec/adapters/oracledb/__init__.py +39 -0
- sqlspec/adapters/oracledb/_json_handlers.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/_json_handlers.py +196 -0
- sqlspec/adapters/oracledb/_param_types.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/_param_types.py +46 -0
- sqlspec/adapters/oracledb/_typing.py +258 -0
- sqlspec/adapters/oracledb/_uuid_handlers.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/_uuid_handlers.py +163 -0
- sqlspec/adapters/oracledb/_vector_handlers.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/_vector_handlers.py +228 -0
- sqlspec/adapters/oracledb/adk/__init__.py +21 -0
- sqlspec/adapters/oracledb/adk/store.py +2453 -0
- sqlspec/adapters/oracledb/config.py +575 -0
- sqlspec/adapters/oracledb/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/core.py +820 -0
- sqlspec/adapters/oracledb/data_dictionary.py +404 -0
- sqlspec/adapters/oracledb/driver.py +1277 -0
- sqlspec/adapters/oracledb/events/__init__.py +16 -0
- sqlspec/adapters/oracledb/events/_hub.py +345 -0
- sqlspec/adapters/oracledb/events/backend.py +300 -0
- sqlspec/adapters/oracledb/events/store.py +420 -0
- sqlspec/adapters/oracledb/litestar/__init__.py +5 -0
- sqlspec/adapters/oracledb/litestar/store.py +781 -0
- sqlspec/adapters/oracledb/migrations.py +539 -0
- sqlspec/adapters/oracledb/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/oracledb/type_converter.py +211 -0
- sqlspec/adapters/psqlpy/__init__.py +18 -0
- sqlspec/adapters/psqlpy/_typing.py +121 -0
- sqlspec/adapters/psqlpy/adk/__init__.py +5 -0
- sqlspec/adapters/psqlpy/adk/store.py +591 -0
- sqlspec/adapters/psqlpy/config.py +376 -0
- sqlspec/adapters/psqlpy/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/psqlpy/core.py +694 -0
- sqlspec/adapters/psqlpy/data_dictionary.py +121 -0
- sqlspec/adapters/psqlpy/driver.py +411 -0
- sqlspec/adapters/psqlpy/events/__init__.py +6 -0
- sqlspec/adapters/psqlpy/events/_hub.py +204 -0
- sqlspec/adapters/psqlpy/events/backend.py +210 -0
- sqlspec/adapters/psqlpy/events/store.py +20 -0
- sqlspec/adapters/psqlpy/litestar/__init__.py +5 -0
- sqlspec/adapters/psqlpy/litestar/store.py +270 -0
- sqlspec/adapters/psqlpy/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/psqlpy/type_converter.py +113 -0
- sqlspec/adapters/psycopg/__init__.py +38 -0
- sqlspec/adapters/psycopg/_typing.py +218 -0
- sqlspec/adapters/psycopg/adk/__init__.py +10 -0
- sqlspec/adapters/psycopg/adk/store.py +1106 -0
- sqlspec/adapters/psycopg/config.py +695 -0
- sqlspec/adapters/psycopg/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/psycopg/core.py +520 -0
- sqlspec/adapters/psycopg/data_dictionary.py +278 -0
- sqlspec/adapters/psycopg/driver.py +1033 -0
- sqlspec/adapters/psycopg/events/__init__.py +20 -0
- sqlspec/adapters/psycopg/events/_hub.py +388 -0
- sqlspec/adapters/psycopg/events/backend.py +398 -0
- sqlspec/adapters/psycopg/events/store.py +42 -0
- sqlspec/adapters/psycopg/litestar/__init__.py +5 -0
- sqlspec/adapters/psycopg/litestar/store.py +554 -0
- sqlspec/adapters/psycopg/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/psycopg/type_converter.py +93 -0
- sqlspec/adapters/pymysql/__init__.py +21 -0
- sqlspec/adapters/pymysql/_typing.py +92 -0
- sqlspec/adapters/pymysql/adk/__init__.py +5 -0
- sqlspec/adapters/pymysql/adk/store.py +657 -0
- sqlspec/adapters/pymysql/config.py +176 -0
- sqlspec/adapters/pymysql/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/pymysql/core.py +469 -0
- sqlspec/adapters/pymysql/data_dictionary.py +120 -0
- sqlspec/adapters/pymysql/driver.py +271 -0
- sqlspec/adapters/pymysql/events/__init__.py +5 -0
- sqlspec/adapters/pymysql/events/store.py +50 -0
- sqlspec/adapters/pymysql/litestar/__init__.py +5 -0
- sqlspec/adapters/pymysql/litestar/store.py +232 -0
- sqlspec/adapters/pymysql/pool.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/pymysql/pool.py +184 -0
- sqlspec/adapters/spanner/__init__.py +33 -0
- sqlspec/adapters/spanner/_typing.py +102 -0
- sqlspec/adapters/spanner/adk/__init__.py +5 -0
- sqlspec/adapters/spanner/adk/store.py +758 -0
- sqlspec/adapters/spanner/config.py +355 -0
- sqlspec/adapters/spanner/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/spanner/core.py +263 -0
- sqlspec/adapters/spanner/data_dictionary.py +120 -0
- sqlspec/adapters/spanner/driver.py +407 -0
- sqlspec/adapters/spanner/events/__init__.py +5 -0
- sqlspec/adapters/spanner/events/store.py +187 -0
- sqlspec/adapters/spanner/litestar/__init__.py +5 -0
- sqlspec/adapters/spanner/litestar/store.py +291 -0
- sqlspec/adapters/spanner/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/spanner/type_converter.py +342 -0
- sqlspec/adapters/sqlite/__init__.py +19 -0
- sqlspec/adapters/sqlite/_typing.py +123 -0
- sqlspec/adapters/sqlite/adk/__init__.py +5 -0
- sqlspec/adapters/sqlite/adk/store.py +992 -0
- sqlspec/adapters/sqlite/config.py +240 -0
- sqlspec/adapters/sqlite/core.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/sqlite/core.py +357 -0
- sqlspec/adapters/sqlite/data_dictionary.py +198 -0
- sqlspec/adapters/sqlite/driver.py +527 -0
- sqlspec/adapters/sqlite/events/__init__.py +5 -0
- sqlspec/adapters/sqlite/events/store.py +20 -0
- sqlspec/adapters/sqlite/litestar/__init__.py +5 -0
- sqlspec/adapters/sqlite/litestar/store.py +316 -0
- sqlspec/adapters/sqlite/pool.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/sqlite/pool.py +237 -0
- sqlspec/adapters/sqlite/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/adapters/sqlite/type_converter.py +114 -0
- sqlspec/base.py +832 -0
- sqlspec/builder/__init__.py +181 -0
- sqlspec/builder/_base.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_base.py +1071 -0
- sqlspec/builder/_column.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_column.py +521 -0
- sqlspec/builder/_ddl.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_ddl.py +1691 -0
- sqlspec/builder/_delete.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_delete.py +95 -0
- sqlspec/builder/_dml.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_dml.py +386 -0
- sqlspec/builder/_explain.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_explain.py +579 -0
- sqlspec/builder/_expression_wrappers.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_expression_wrappers.py +46 -0
- sqlspec/builder/_factory.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_factory.py +1884 -0
- sqlspec/builder/_insert.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_insert.py +405 -0
- sqlspec/builder/_join.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_join.py +489 -0
- sqlspec/builder/_merge.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_merge.py +823 -0
- sqlspec/builder/_parsing_utils.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_parsing_utils.py +295 -0
- sqlspec/builder/_select.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_select.py +1666 -0
- sqlspec/builder/_temporal.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_temporal.py +167 -0
- sqlspec/builder/_update.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_update.py +173 -0
- sqlspec/builder/_vector_distance.cp314-win_amd64.pyd +0 -0
- sqlspec/builder/_vector_distance.py +330 -0
- sqlspec/cli.py +1095 -0
- sqlspec/config.py +2383 -0
- sqlspec/core/__init__.py +372 -0
- sqlspec/core/_correlation.cp314-win_amd64.pyd +0 -0
- sqlspec/core/_correlation.py +176 -0
- sqlspec/core/_pagination.py +42 -0
- sqlspec/core/_pool.cp314-win_amd64.pyd +0 -0
- sqlspec/core/_pool.py +76 -0
- sqlspec/core/cache.cp314-win_amd64.pyd +0 -0
- sqlspec/core/cache.py +1085 -0
- sqlspec/core/compiler.cp314-win_amd64.pyd +0 -0
- sqlspec/core/compiler.py +1090 -0
- sqlspec/core/config_runtime.cp314-win_amd64.pyd +0 -0
- sqlspec/core/config_runtime.py +174 -0
- sqlspec/core/explain.cp314-win_amd64.pyd +0 -0
- sqlspec/core/explain.py +275 -0
- sqlspec/core/filters.cp314-win_amd64.pyd +0 -0
- sqlspec/core/filters.py +969 -0
- sqlspec/core/hashing.cp314-win_amd64.pyd +0 -0
- sqlspec/core/hashing.py +266 -0
- sqlspec/core/metrics.cp314-win_amd64.pyd +0 -0
- sqlspec/core/metrics.py +83 -0
- sqlspec/core/parameters/__init__.py +72 -0
- sqlspec/core/parameters/_alignment.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_alignment.py +283 -0
- sqlspec/core/parameters/_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_converter.py +554 -0
- sqlspec/core/parameters/_processor.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_processor.py +1182 -0
- sqlspec/core/parameters/_registry.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_registry.py +206 -0
- sqlspec/core/parameters/_transformers.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_transformers.py +324 -0
- sqlspec/core/parameters/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_types.py +536 -0
- sqlspec/core/parameters/_validator.cp314-win_amd64.pyd +0 -0
- sqlspec/core/parameters/_validator.py +171 -0
- sqlspec/core/pipeline.cp314-win_amd64.pyd +0 -0
- sqlspec/core/pipeline.py +333 -0
- sqlspec/core/query_modifiers.cp314-win_amd64.pyd +0 -0
- sqlspec/core/query_modifiers.py +508 -0
- sqlspec/core/result/__init__.py +25 -0
- sqlspec/core/result/_base.cp314-win_amd64.pyd +0 -0
- sqlspec/core/result/_base.py +1232 -0
- sqlspec/core/result/_io.cp314-win_amd64.pyd +0 -0
- sqlspec/core/result/_io.py +28 -0
- sqlspec/core/splitter.cp314-win_amd64.pyd +0 -0
- sqlspec/core/splitter.py +1021 -0
- sqlspec/core/sqlcommenter.cp314-win_amd64.pyd +0 -0
- sqlspec/core/sqlcommenter.py +249 -0
- sqlspec/core/stack.cp314-win_amd64.pyd +0 -0
- sqlspec/core/stack.py +163 -0
- sqlspec/core/statement.cp314-win_amd64.pyd +0 -0
- sqlspec/core/statement.py +1865 -0
- sqlspec/core/type_converter.cp314-win_amd64.pyd +0 -0
- sqlspec/core/type_converter.py +340 -0
- sqlspec/data_dictionary/__init__.py +22 -0
- sqlspec/data_dictionary/_loader.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/_loader.py +138 -0
- sqlspec/data_dictionary/_registry.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/_registry.py +74 -0
- sqlspec/data_dictionary/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/_types.py +121 -0
- sqlspec/data_dictionary/dialects/__init__.py +21 -0
- sqlspec/data_dictionary/dialects/bigquery.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/bigquery.py +81 -0
- sqlspec/data_dictionary/dialects/cockroachdb.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/cockroachdb.py +54 -0
- sqlspec/data_dictionary/dialects/duckdb.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/duckdb.py +47 -0
- sqlspec/data_dictionary/dialects/mysql.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/mysql.py +53 -0
- sqlspec/data_dictionary/dialects/oracle.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/oracle.py +197 -0
- sqlspec/data_dictionary/dialects/postgres.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/postgres.py +69 -0
- sqlspec/data_dictionary/dialects/spanner.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/spanner.py +37 -0
- sqlspec/data_dictionary/dialects/sqlite.cp314-win_amd64.pyd +0 -0
- sqlspec/data_dictionary/dialects/sqlite.py +59 -0
- sqlspec/data_dictionary/sql/.gitkeep +0 -0
- sqlspec/data_dictionary/sql/bigquery/columns.sql +23 -0
- sqlspec/data_dictionary/sql/bigquery/foreign_keys.sql +34 -0
- sqlspec/data_dictionary/sql/bigquery/indexes.sql +19 -0
- sqlspec/data_dictionary/sql/bigquery/tables.sql +33 -0
- sqlspec/data_dictionary/sql/bigquery/version.sql +3 -0
- sqlspec/data_dictionary/sql/cockroachdb/columns.sql +34 -0
- sqlspec/data_dictionary/sql/cockroachdb/foreign_keys.sql +40 -0
- sqlspec/data_dictionary/sql/cockroachdb/indexes.sql +32 -0
- sqlspec/data_dictionary/sql/cockroachdb/tables.sql +44 -0
- sqlspec/data_dictionary/sql/cockroachdb/version.sql +3 -0
- sqlspec/data_dictionary/sql/duckdb/columns.sql +23 -0
- sqlspec/data_dictionary/sql/duckdb/foreign_keys.sql +36 -0
- sqlspec/data_dictionary/sql/duckdb/indexes.sql +19 -0
- sqlspec/data_dictionary/sql/duckdb/tables.sql +38 -0
- sqlspec/data_dictionary/sql/duckdb/version.sql +3 -0
- sqlspec/data_dictionary/sql/mysql/columns.sql +23 -0
- sqlspec/data_dictionary/sql/mysql/foreign_keys.sql +28 -0
- sqlspec/data_dictionary/sql/mysql/indexes.sql +26 -0
- sqlspec/data_dictionary/sql/mysql/tables.sql +33 -0
- sqlspec/data_dictionary/sql/mysql/version.sql +3 -0
- sqlspec/data_dictionary/sql/oracle/columns.sql +23 -0
- sqlspec/data_dictionary/sql/oracle/foreign_keys.sql +48 -0
- sqlspec/data_dictionary/sql/oracle/indexes.sql +44 -0
- sqlspec/data_dictionary/sql/oracle/tables.sql +25 -0
- sqlspec/data_dictionary/sql/oracle/version.sql +20 -0
- sqlspec/data_dictionary/sql/postgres/columns.sql +34 -0
- sqlspec/data_dictionary/sql/postgres/foreign_keys.sql +40 -0
- sqlspec/data_dictionary/sql/postgres/indexes.sql +56 -0
- sqlspec/data_dictionary/sql/postgres/tables.sql +44 -0
- sqlspec/data_dictionary/sql/postgres/version.sql +3 -0
- sqlspec/data_dictionary/sql/spanner/columns.sql +23 -0
- sqlspec/data_dictionary/sql/spanner/foreign_keys.sql +70 -0
- sqlspec/data_dictionary/sql/spanner/indexes.sql +30 -0
- sqlspec/data_dictionary/sql/spanner/tables.sql +9 -0
- sqlspec/data_dictionary/sql/spanner/version.sql +3 -0
- sqlspec/data_dictionary/sql/sqlite/columns.sql +23 -0
- sqlspec/data_dictionary/sql/sqlite/foreign_keys.sql +22 -0
- sqlspec/data_dictionary/sql/sqlite/indexes.sql +7 -0
- sqlspec/data_dictionary/sql/sqlite/tables.sql +28 -0
- sqlspec/data_dictionary/sql/sqlite/version.sql +3 -0
- sqlspec/dialects/__init__.py +22 -0
- sqlspec/dialects/_compat.cp314-win_amd64.pyd +0 -0
- sqlspec/dialects/_compat.py +14 -0
- sqlspec/dialects/postgres/__init__.py +9 -0
- sqlspec/dialects/postgres/_generators.cp314-win_amd64.pyd +0 -0
- sqlspec/dialects/postgres/_generators.py +57 -0
- sqlspec/dialects/postgres/_operators.cp314-win_amd64.pyd +0 -0
- sqlspec/dialects/postgres/_operators.py +81 -0
- sqlspec/dialects/postgres/_paradedb.py +50 -0
- sqlspec/dialects/postgres/_pgvector.py +36 -0
- sqlspec/dialects/spanner/__init__.py +6 -0
- sqlspec/dialects/spanner/_generators.cp314-win_amd64.pyd +0 -0
- sqlspec/dialects/spanner/_generators.py +206 -0
- sqlspec/dialects/spanner/_spangres.py +77 -0
- sqlspec/dialects/spanner/_spanner.py +179 -0
- sqlspec/driver/__init__.py +49 -0
- sqlspec/driver/_async.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_async.py +1830 -0
- sqlspec/driver/_common.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_common.py +2292 -0
- sqlspec/driver/_exception_handler.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_exception_handler.py +108 -0
- sqlspec/driver/_query_cache.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_query_cache.py +96 -0
- sqlspec/driver/_sql_helpers.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_sql_helpers.py +139 -0
- sqlspec/driver/_storage_helpers.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_storage_helpers.py +153 -0
- sqlspec/driver/_sync.cp314-win_amd64.pyd +0 -0
- sqlspec/driver/_sync.py +1817 -0
- sqlspec/exceptions.cp314-win_amd64.pyd +0 -0
- sqlspec/exceptions.py +480 -0
- sqlspec/extensions/__init__.py +0 -0
- sqlspec/extensions/adk/__init__.py +84 -0
- sqlspec/extensions/adk/_config_utils.py +199 -0
- sqlspec/extensions/adk/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/adk/_types.py +41 -0
- sqlspec/extensions/adk/artifact/__init__.py +57 -0
- sqlspec/extensions/adk/artifact/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/adk/artifact/_types.py +32 -0
- sqlspec/extensions/adk/artifact/service.py +508 -0
- sqlspec/extensions/adk/artifact/store.py +361 -0
- sqlspec/extensions/adk/converters.py +212 -0
- sqlspec/extensions/adk/memory/__init__.py +69 -0
- sqlspec/extensions/adk/memory/_types.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/adk/memory/_types.py +30 -0
- sqlspec/extensions/adk/memory/converters.py +225 -0
- sqlspec/extensions/adk/memory/service.py +316 -0
- sqlspec/extensions/adk/memory/store.py +525 -0
- sqlspec/extensions/adk/migrations/0001_create_adk_tables.py +184 -0
- sqlspec/extensions/adk/migrations/__init__.py +0 -0
- sqlspec/extensions/adk/service.py +279 -0
- sqlspec/extensions/adk/store.py +590 -0
- sqlspec/extensions/events/__init__.py +51 -0
- sqlspec/extensions/events/_channel.py +703 -0
- sqlspec/extensions/events/_hints.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/events/_hints.py +45 -0
- sqlspec/extensions/events/_models.py +23 -0
- sqlspec/extensions/events/_payload.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/events/_payload.py +69 -0
- sqlspec/extensions/events/_protocols.py +134 -0
- sqlspec/extensions/events/_queue.py +462 -0
- sqlspec/extensions/events/_store.py +209 -0
- sqlspec/extensions/events/migrations/0001_create_event_queue.py +59 -0
- sqlspec/extensions/events/migrations/__init__.py +3 -0
- sqlspec/extensions/fastapi/__init__.py +22 -0
- sqlspec/extensions/fastapi/extension.py +391 -0
- sqlspec/extensions/fastapi/providers.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/fastapi/providers.py +712 -0
- sqlspec/extensions/flask/__init__.py +38 -0
- sqlspec/extensions/flask/_state.py +87 -0
- sqlspec/extensions/flask/_utils.py +71 -0
- sqlspec/extensions/flask/extension.py +539 -0
- sqlspec/extensions/litestar/__init__.py +31 -0
- sqlspec/extensions/litestar/_utils.py +52 -0
- sqlspec/extensions/litestar/channels.py +165 -0
- sqlspec/extensions/litestar/cli.py +102 -0
- sqlspec/extensions/litestar/config.py +90 -0
- sqlspec/extensions/litestar/handlers.py +316 -0
- sqlspec/extensions/litestar/migrations/0001_create_session_table.py +137 -0
- sqlspec/extensions/litestar/migrations/__init__.py +3 -0
- sqlspec/extensions/litestar/plugin.py +1066 -0
- sqlspec/extensions/litestar/providers.cp314-win_amd64.pyd +0 -0
- sqlspec/extensions/litestar/providers.py +784 -0
- sqlspec/extensions/litestar/store.py +298 -0
- sqlspec/extensions/otel/__init__.py +58 -0
- sqlspec/extensions/prometheus/__init__.py +113 -0
- sqlspec/extensions/sanic/__init__.py +19 -0
- sqlspec/extensions/sanic/_state.py +43 -0
- sqlspec/extensions/sanic/_utils.py +127 -0
- sqlspec/extensions/sanic/extension.py +647 -0
- sqlspec/extensions/starlette/__init__.py +22 -0
- sqlspec/extensions/starlette/_state.py +42 -0
- sqlspec/extensions/starlette/_utils.py +96 -0
- sqlspec/extensions/starlette/extension.py +374 -0
- sqlspec/extensions/starlette/middleware.py +281 -0
- sqlspec/loader.cp314-win_amd64.pyd +0 -0
- sqlspec/loader.py +727 -0
- sqlspec/migrations/__init__.py +39 -0
- sqlspec/migrations/base.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/base.py +862 -0
- sqlspec/migrations/commands.py +2151 -0
- sqlspec/migrations/context.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/context.py +157 -0
- sqlspec/migrations/fix.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/fix.py +204 -0
- sqlspec/migrations/loaders.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/loaders.py +443 -0
- sqlspec/migrations/runner.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/runner.py +1195 -0
- sqlspec/migrations/squash.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/squash.py +490 -0
- sqlspec/migrations/templates.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/templates.py +234 -0
- sqlspec/migrations/tracker.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/tracker.py +792 -0
- sqlspec/migrations/utils.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/utils.py +256 -0
- sqlspec/migrations/validation.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/validation.py +359 -0
- sqlspec/migrations/version.cp314-win_amd64.pyd +0 -0
- sqlspec/migrations/version.py +446 -0
- sqlspec/observability/__init__.py +57 -0
- sqlspec/observability/_common.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_common.py +77 -0
- sqlspec/observability/_config.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_config.py +364 -0
- sqlspec/observability/_diagnostics.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_diagnostics.py +74 -0
- sqlspec/observability/_dispatcher.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_dispatcher.py +200 -0
- sqlspec/observability/_formatters/__init__.py +13 -0
- sqlspec/observability/_formatters/_aws.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_formatters/_aws.py +102 -0
- sqlspec/observability/_formatters/_azure.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_formatters/_azure.py +96 -0
- sqlspec/observability/_formatters/_base.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_formatters/_base.py +57 -0
- sqlspec/observability/_formatters/_gcp.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_formatters/_gcp.py +131 -0
- sqlspec/observability/_formatting.py +58 -0
- sqlspec/observability/_observer.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_observer.py +361 -0
- sqlspec/observability/_runtime.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_runtime.py +461 -0
- sqlspec/observability/_sampling.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_sampling.py +188 -0
- sqlspec/observability/_spans.cp314-win_amd64.pyd +0 -0
- sqlspec/observability/_spans.py +161 -0
- sqlspec/protocols.py +955 -0
- sqlspec/py.typed +0 -0
- sqlspec/service.py +433 -0
- sqlspec/storage/__init__.py +48 -0
- sqlspec/storage/_arrow_payload.py +68 -0
- sqlspec/storage/_paths.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/_paths.py +58 -0
- sqlspec/storage/_utils.py +46 -0
- sqlspec/storage/backends/__init__.py +1 -0
- sqlspec/storage/backends/base.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/backends/base.py +374 -0
- sqlspec/storage/backends/fsspec.py +574 -0
- sqlspec/storage/backends/local.py +468 -0
- sqlspec/storage/backends/obstore.py +956 -0
- sqlspec/storage/errors.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/errors.py +102 -0
- sqlspec/storage/pipeline.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/pipeline.py +628 -0
- sqlspec/storage/registry.cp314-win_amd64.pyd +0 -0
- sqlspec/storage/registry.py +329 -0
- sqlspec/typing.py +405 -0
- sqlspec/utils/__init__.py +7 -0
- sqlspec/utils/arrow_helpers.py +384 -0
- sqlspec/utils/config_tools.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/config_tools.py +314 -0
- sqlspec/utils/correlation.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/correlation.py +134 -0
- sqlspec/utils/deprecation.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/deprecation.py +157 -0
- sqlspec/utils/dispatch.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/dispatch.py +101 -0
- sqlspec/utils/fixtures.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/fixtures.py +260 -0
- sqlspec/utils/logging.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/logging.py +251 -0
- sqlspec/utils/module_loader.py +306 -0
- sqlspec/utils/portal.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/portal.py +377 -0
- sqlspec/utils/schema.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/schema.py +1040 -0
- sqlspec/utils/serializers/__init__.py +30 -0
- sqlspec/utils/serializers/_json.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/serializers/_json.py +415 -0
- sqlspec/utils/serializers/_numpy.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/serializers/_numpy.py +65 -0
- sqlspec/utils/serializers/_schema.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/serializers/_schema.py +285 -0
- sqlspec/utils/singleton.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/singleton.py +41 -0
- sqlspec/utils/sync_tools.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/sync_tools.py +316 -0
- sqlspec/utils/text.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/text.py +109 -0
- sqlspec/utils/type_converters.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/type_converters.py +216 -0
- sqlspec/utils/type_guards.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/type_guards.py +1508 -0
- sqlspec/utils/uuids.cp314-win_amd64.pyd +0 -0
- sqlspec/utils/uuids.py +241 -0
- sqlspec-0.47.0.dist-info/METADATA +202 -0
- sqlspec-0.47.0.dist-info/RECORD +621 -0
- sqlspec-0.47.0.dist-info/WHEEL +4 -0
- sqlspec-0.47.0.dist-info/entry_points.txt +6 -0
- sqlspec-0.47.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Dialect configuration registrations."""
|
|
2
|
+
|
|
3
|
+
from sqlspec.data_dictionary.dialects.bigquery import BIGQUERY_CONFIG
|
|
4
|
+
from sqlspec.data_dictionary.dialects.cockroachdb import COCKROACHDB_CONFIG
|
|
5
|
+
from sqlspec.data_dictionary.dialects.duckdb import DUCKDB_CONFIG
|
|
6
|
+
from sqlspec.data_dictionary.dialects.mysql import MYSQL_CONFIG
|
|
7
|
+
from sqlspec.data_dictionary.dialects.oracle import ORACLE_CONFIG
|
|
8
|
+
from sqlspec.data_dictionary.dialects.postgres import POSTGRES_CONFIG
|
|
9
|
+
from sqlspec.data_dictionary.dialects.spanner import SPANNER_CONFIG
|
|
10
|
+
from sqlspec.data_dictionary.dialects.sqlite import SQLITE_CONFIG
|
|
11
|
+
|
|
12
|
+
__all__ = (
|
|
13
|
+
"BIGQUERY_CONFIG",
|
|
14
|
+
"COCKROACHDB_CONFIG",
|
|
15
|
+
"DUCKDB_CONFIG",
|
|
16
|
+
"MYSQL_CONFIG",
|
|
17
|
+
"ORACLE_CONFIG",
|
|
18
|
+
"POSTGRES_CONFIG",
|
|
19
|
+
"SPANNER_CONFIG",
|
|
20
|
+
"SQLITE_CONFIG",
|
|
21
|
+
)
|
|
Binary file
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from sqlspec.data_dictionary import DialectConfig, FeatureFlags, FeatureVersions, register_dialect
|
|
4
|
+
|
|
5
|
+
__all__ = ("format_bigquery_information_schema_tables", "format_bigquery_schema_prefix")
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
BIGQUERY_VERSION_PATTERN = re.compile(r".*")
|
|
9
|
+
|
|
10
|
+
BIGQUERY_FEATURE_VERSIONS: "FeatureVersions" = {}
|
|
11
|
+
|
|
12
|
+
BIGQUERY_FEATURE_FLAGS: "FeatureFlags" = {
|
|
13
|
+
"supports_json": True,
|
|
14
|
+
"supports_arrays": True,
|
|
15
|
+
"supports_structs": True,
|
|
16
|
+
"supports_geography": True,
|
|
17
|
+
"supports_returning": False,
|
|
18
|
+
"supports_upsert": True,
|
|
19
|
+
"supports_window_functions": True,
|
|
20
|
+
"supports_cte": True,
|
|
21
|
+
"supports_transactions": True,
|
|
22
|
+
"supports_prepared_statements": True,
|
|
23
|
+
"supports_schemas": True,
|
|
24
|
+
"supports_partitioning": True,
|
|
25
|
+
"supports_clustering": True,
|
|
26
|
+
"supports_uuid": False,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
BIGQUERY_TYPE_MAPPINGS: dict[str, str] = {
|
|
30
|
+
"json": "JSON",
|
|
31
|
+
"uuid": "STRING",
|
|
32
|
+
"boolean": "BOOL",
|
|
33
|
+
"timestamp": "TIMESTAMP",
|
|
34
|
+
"text": "STRING",
|
|
35
|
+
"blob": "BYTES",
|
|
36
|
+
"array": "ARRAY",
|
|
37
|
+
"struct": "STRUCT",
|
|
38
|
+
"geography": "GEOGRAPHY",
|
|
39
|
+
"numeric": "NUMERIC",
|
|
40
|
+
"bignumeric": "BIGNUMERIC",
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
BIGQUERY_CONFIG = DialectConfig(
|
|
45
|
+
name="bigquery",
|
|
46
|
+
feature_versions=BIGQUERY_FEATURE_VERSIONS,
|
|
47
|
+
feature_flags=BIGQUERY_FEATURE_FLAGS,
|
|
48
|
+
type_mappings=BIGQUERY_TYPE_MAPPINGS,
|
|
49
|
+
version_pattern=BIGQUERY_VERSION_PATTERN,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
register_dialect(BIGQUERY_CONFIG)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def format_bigquery_information_schema_tables(schema: "str | None") -> "tuple[str, str, str]":
|
|
56
|
+
"""Format BigQuery INFORMATION_SCHEMA table identifiers for metadata queries.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
schema: Optional BigQuery project.dataset schema qualifier.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
TABLES, KEY_COLUMN_USAGE, and REFERENTIAL_CONSTRAINTS identifiers.
|
|
63
|
+
"""
|
|
64
|
+
if schema:
|
|
65
|
+
return (
|
|
66
|
+
f"`{schema}.INFORMATION_SCHEMA.TABLES`",
|
|
67
|
+
f"`{schema}.INFORMATION_SCHEMA.KEY_COLUMN_USAGE`",
|
|
68
|
+
f"`{schema}.INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS`",
|
|
69
|
+
)
|
|
70
|
+
return (
|
|
71
|
+
"INFORMATION_SCHEMA.TABLES",
|
|
72
|
+
"INFORMATION_SCHEMA.KEY_COLUMN_USAGE",
|
|
73
|
+
"INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS",
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def format_bigquery_schema_prefix(schema: "str | None") -> str:
|
|
78
|
+
"""Format a BigQuery schema prefix for INFORMATION_SCHEMA queries."""
|
|
79
|
+
if schema:
|
|
80
|
+
return f"`{schema}`."
|
|
81
|
+
return ""
|
|
Binary file
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from sqlspec.data_dictionary import DialectConfig, FeatureFlags, FeatureVersions, register_dialect
|
|
4
|
+
from sqlspec.typing import VersionInfo
|
|
5
|
+
|
|
6
|
+
__all__ = ("resolve_cockroachdb_json_type",)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
COCKROACHDB_VERSION_PATTERN = re.compile(r"CockroachDB (?:CCL )?v(\d+)\.(\d+)\.(\d+)")
|
|
10
|
+
|
|
11
|
+
COCKROACHDB_FEATURE_VERSIONS: "FeatureVersions" = {
|
|
12
|
+
"supports_json": VersionInfo(20, 1, 0),
|
|
13
|
+
"supports_returning": VersionInfo(20, 1, 0),
|
|
14
|
+
"supports_upsert": VersionInfo(19, 2, 0),
|
|
15
|
+
"supports_window_functions": VersionInfo(19, 1, 0),
|
|
16
|
+
"supports_cte": VersionInfo(19, 1, 0),
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
COCKROACHDB_FEATURE_FLAGS: "FeatureFlags" = {
|
|
20
|
+
"supports_uuid": True,
|
|
21
|
+
"supports_arrays": True,
|
|
22
|
+
"supports_transactions": True,
|
|
23
|
+
"supports_prepared_statements": True,
|
|
24
|
+
"supports_schemas": True,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
COCKROACHDB_TYPE_MAPPINGS: dict[str, str] = {
|
|
28
|
+
"uuid": "UUID",
|
|
29
|
+
"boolean": "BOOL",
|
|
30
|
+
"timestamp": "TIMESTAMPTZ",
|
|
31
|
+
"text": "STRING",
|
|
32
|
+
"blob": "BYTES",
|
|
33
|
+
"array": "ARRAY",
|
|
34
|
+
"json": "JSONB",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
COCKROACHDB_CONFIG = DialectConfig(
|
|
38
|
+
name="cockroachdb",
|
|
39
|
+
feature_versions=COCKROACHDB_FEATURE_VERSIONS,
|
|
40
|
+
feature_flags=COCKROACHDB_FEATURE_FLAGS,
|
|
41
|
+
type_mappings=COCKROACHDB_TYPE_MAPPINGS,
|
|
42
|
+
version_pattern=COCKROACHDB_VERSION_PATTERN,
|
|
43
|
+
default_schema="public",
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
register_dialect(COCKROACHDB_CONFIG)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def resolve_cockroachdb_json_type(version_info: "VersionInfo | None") -> str:
|
|
50
|
+
"""Resolve the best CockroachDB JSON storage type for a database version."""
|
|
51
|
+
json_version = COCKROACHDB_CONFIG.get_feature_version("supports_json")
|
|
52
|
+
if version_info and json_version and version_info >= json_version:
|
|
53
|
+
return COCKROACHDB_CONFIG.get_optimal_type("json")
|
|
54
|
+
return "TEXT"
|
|
Binary file
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from sqlspec.data_dictionary import DialectConfig, FeatureFlags, FeatureVersions, register_dialect
|
|
4
|
+
from sqlspec.typing import VersionInfo
|
|
5
|
+
|
|
6
|
+
DUCKDB_VERSION_PATTERN = re.compile(r"v?(\d+)\.(\d+)\.(\d+)")
|
|
7
|
+
|
|
8
|
+
DUCKDB_FEATURE_VERSIONS: "FeatureVersions" = {
|
|
9
|
+
"supports_returning": VersionInfo(0, 8, 0),
|
|
10
|
+
"supports_upsert": VersionInfo(0, 8, 0),
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
DUCKDB_FEATURE_FLAGS: "FeatureFlags" = {
|
|
14
|
+
"supports_json": True,
|
|
15
|
+
"supports_arrays": True,
|
|
16
|
+
"supports_maps": True,
|
|
17
|
+
"supports_structs": True,
|
|
18
|
+
"supports_window_functions": True,
|
|
19
|
+
"supports_cte": True,
|
|
20
|
+
"supports_transactions": True,
|
|
21
|
+
"supports_prepared_statements": True,
|
|
22
|
+
"supports_schemas": True,
|
|
23
|
+
"supports_uuid": True,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
DUCKDB_TYPE_MAPPINGS: dict[str, str] = {
|
|
27
|
+
"json": "JSON",
|
|
28
|
+
"uuid": "UUID",
|
|
29
|
+
"boolean": "BOOLEAN",
|
|
30
|
+
"timestamp": "TIMESTAMP",
|
|
31
|
+
"text": "TEXT",
|
|
32
|
+
"blob": "BLOB",
|
|
33
|
+
"array": "LIST",
|
|
34
|
+
"map": "MAP",
|
|
35
|
+
"struct": "STRUCT",
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
DUCKDB_CONFIG = DialectConfig(
|
|
40
|
+
name="duckdb",
|
|
41
|
+
feature_versions=DUCKDB_FEATURE_VERSIONS,
|
|
42
|
+
feature_flags=DUCKDB_FEATURE_FLAGS,
|
|
43
|
+
type_mappings=DUCKDB_TYPE_MAPPINGS,
|
|
44
|
+
version_pattern=DUCKDB_VERSION_PATTERN,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
register_dialect(DUCKDB_CONFIG)
|
|
Binary file
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from sqlspec.data_dictionary import DialectConfig, FeatureFlags, FeatureVersions, register_dialect
|
|
4
|
+
from sqlspec.typing import VersionInfo
|
|
5
|
+
|
|
6
|
+
__all__ = ("resolve_mysql_json_type",)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
MYSQL_VERSION_PATTERN = re.compile(r"(\d+)\.(\d+)\.(\d+)")
|
|
10
|
+
|
|
11
|
+
MYSQL_FEATURE_VERSIONS: "FeatureVersions" = {
|
|
12
|
+
"supports_json": VersionInfo(5, 7, 8),
|
|
13
|
+
"supports_cte": VersionInfo(8, 0, 1),
|
|
14
|
+
"supports_window_functions": VersionInfo(8, 0, 2),
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
MYSQL_FEATURE_FLAGS: "FeatureFlags" = {
|
|
18
|
+
"supports_returning": False,
|
|
19
|
+
"supports_upsert": True,
|
|
20
|
+
"supports_transactions": True,
|
|
21
|
+
"supports_prepared_statements": True,
|
|
22
|
+
"supports_schemas": True,
|
|
23
|
+
"supports_arrays": False,
|
|
24
|
+
"supports_uuid": False,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
MYSQL_TYPE_MAPPINGS: dict[str, str] = {
|
|
28
|
+
"uuid": "VARCHAR(36)",
|
|
29
|
+
"boolean": "TINYINT(1)",
|
|
30
|
+
"timestamp": "TIMESTAMP",
|
|
31
|
+
"text": "TEXT",
|
|
32
|
+
"blob": "BLOB",
|
|
33
|
+
"json": "JSON",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
MYSQL_CONFIG = DialectConfig(
|
|
38
|
+
name="mysql",
|
|
39
|
+
feature_versions=MYSQL_FEATURE_VERSIONS,
|
|
40
|
+
feature_flags=MYSQL_FEATURE_FLAGS,
|
|
41
|
+
type_mappings=MYSQL_TYPE_MAPPINGS,
|
|
42
|
+
version_pattern=MYSQL_VERSION_PATTERN,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
register_dialect(MYSQL_CONFIG)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def resolve_mysql_json_type(version_info: "VersionInfo | None") -> str:
|
|
49
|
+
"""Resolve the best MySQL JSON storage type for a database version."""
|
|
50
|
+
json_version = MYSQL_CONFIG.get_feature_version("supports_json")
|
|
51
|
+
if version_info and json_version and version_info >= json_version:
|
|
52
|
+
return "JSON"
|
|
53
|
+
return "TEXT"
|
|
Binary file
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from typing import TYPE_CHECKING, Final
|
|
4
|
+
|
|
5
|
+
from sqlspec.data_dictionary import DialectConfig, FeatureFlags, FeatureVersions, register_dialect
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from sqlspec.typing import TableMetadata, VersionInfo
|
|
9
|
+
|
|
10
|
+
__all__ = (
|
|
11
|
+
"extract_oracle_version_value",
|
|
12
|
+
"list_oracle_available_features",
|
|
13
|
+
"merge_oracle_table_lists",
|
|
14
|
+
"oracle_supports_json_blob",
|
|
15
|
+
"oracle_supports_native_json",
|
|
16
|
+
"oracle_supports_oson_blob",
|
|
17
|
+
"parse_oracle_compatible_major",
|
|
18
|
+
"parse_oracle_version_components",
|
|
19
|
+
"resolve_oracle_feature_flag",
|
|
20
|
+
"resolve_oracle_json_type",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
ORACLE_VERSION_PATTERN = re.compile(r"(\d+)")
|
|
25
|
+
ORACLE_VERSION_PARTS_COUNT: Final[int] = 3
|
|
26
|
+
ORACLE_MIN_JSON_NATIVE_VERSION: Final[int] = 21
|
|
27
|
+
ORACLE_MIN_JSON_NATIVE_COMPATIBLE: Final[int] = 20
|
|
28
|
+
ORACLE_MIN_JSON_BLOB_VERSION: Final[int] = 12
|
|
29
|
+
ORACLE_MIN_OSON_VERSION: Final[int] = 19
|
|
30
|
+
|
|
31
|
+
ORACLE_DYNAMIC_FEATURES: Final[tuple[str, ...]] = (
|
|
32
|
+
"is_autonomous",
|
|
33
|
+
"supports_native_json",
|
|
34
|
+
"supports_oson_blob",
|
|
35
|
+
"supports_json_blob",
|
|
36
|
+
"supports_json",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
ORACLE_FEATURE_VERSIONS: "FeatureVersions" = {}
|
|
40
|
+
|
|
41
|
+
ORACLE_FEATURE_FLAGS: "FeatureFlags" = {
|
|
42
|
+
"supports_transactions": True,
|
|
43
|
+
"supports_prepared_statements": True,
|
|
44
|
+
"supports_schemas": True,
|
|
45
|
+
"supports_in_memory": True,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
ORACLE_TYPE_MAPPINGS: dict[str, str] = {
|
|
49
|
+
"uuid": "RAW(16)",
|
|
50
|
+
"boolean": "NUMBER(1)",
|
|
51
|
+
"timestamp": "TIMESTAMP",
|
|
52
|
+
"text": "CLOB",
|
|
53
|
+
"blob": "BLOB",
|
|
54
|
+
"json": "JSON",
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
ORACLE_CONFIG = DialectConfig(
|
|
59
|
+
name="oracle",
|
|
60
|
+
feature_versions=ORACLE_FEATURE_VERSIONS,
|
|
61
|
+
feature_flags=ORACLE_FEATURE_FLAGS,
|
|
62
|
+
type_mappings=ORACLE_TYPE_MAPPINGS,
|
|
63
|
+
version_pattern=ORACLE_VERSION_PATTERN,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
register_dialect(ORACLE_CONFIG)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def parse_oracle_compatible_major(compatible: "str | None") -> "int | None":
|
|
70
|
+
"""Parse the major version from an Oracle compatible parameter value.
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
compatible: Oracle compatible parameter value.
|
|
74
|
+
|
|
75
|
+
Returns:
|
|
76
|
+
Compatible major version or None when unavailable.
|
|
77
|
+
"""
|
|
78
|
+
if not compatible:
|
|
79
|
+
return None
|
|
80
|
+
parts = compatible.split(".")
|
|
81
|
+
if not parts:
|
|
82
|
+
return None
|
|
83
|
+
return int(parts[0])
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def oracle_supports_native_json(major: int, compatible_major: "int | None") -> bool:
|
|
87
|
+
"""Return whether an Oracle version supports the native JSON data type."""
|
|
88
|
+
return major >= ORACLE_MIN_JSON_NATIVE_VERSION and (compatible_major or 0) >= ORACLE_MIN_JSON_NATIVE_COMPATIBLE
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def oracle_supports_oson_blob(major: int, is_autonomous: bool) -> bool:
|
|
92
|
+
"""Return whether an Oracle version supports BLOB with OSON format."""
|
|
93
|
+
if major >= ORACLE_MIN_JSON_NATIVE_VERSION:
|
|
94
|
+
return True
|
|
95
|
+
return major >= ORACLE_MIN_OSON_VERSION and is_autonomous
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def oracle_supports_json_blob(major: int) -> bool:
|
|
99
|
+
"""Return whether an Oracle version supports BLOB with JSON validation."""
|
|
100
|
+
return major >= ORACLE_MIN_JSON_BLOB_VERSION
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def extract_oracle_version_value(row: object) -> "str | None":
|
|
104
|
+
"""Extract an Oracle version string from a row-like object.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
row: Row value returned by an Oracle version query.
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
Version string when one can be found, otherwise None.
|
|
111
|
+
"""
|
|
112
|
+
if isinstance(row, Mapping):
|
|
113
|
+
for key in ("version", "VERSION", "Version"):
|
|
114
|
+
value = row.get(key)
|
|
115
|
+
if value:
|
|
116
|
+
return str(value)
|
|
117
|
+
if isinstance(row, (list, tuple)) and row:
|
|
118
|
+
return str(row[0])
|
|
119
|
+
if row is not None:
|
|
120
|
+
return str(row)
|
|
121
|
+
return None
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def parse_oracle_version_components(version_str: str) -> "tuple[int, int, int] | None":
|
|
125
|
+
"""Parse Oracle version text into major, minor, patch components."""
|
|
126
|
+
parts = [int(value) for value in ORACLE_VERSION_PATTERN.findall(version_str)]
|
|
127
|
+
if not parts:
|
|
128
|
+
return None
|
|
129
|
+
while len(parts) < ORACLE_VERSION_PARTS_COUNT:
|
|
130
|
+
parts.append(0)
|
|
131
|
+
return parts[0], parts[1], parts[2]
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def resolve_oracle_json_type(
|
|
135
|
+
version_info: "VersionInfo | None", *, compatible_major: "int | None", is_autonomous: bool
|
|
136
|
+
) -> str:
|
|
137
|
+
"""Resolve the best Oracle JSON storage type for a database version."""
|
|
138
|
+
if version_info is None:
|
|
139
|
+
return "CLOB"
|
|
140
|
+
if oracle_supports_native_json(version_info.major, compatible_major):
|
|
141
|
+
return "JSON"
|
|
142
|
+
if oracle_supports_oson_blob(version_info.major, is_autonomous):
|
|
143
|
+
return "BLOB"
|
|
144
|
+
if oracle_supports_json_blob(version_info.major):
|
|
145
|
+
return "BLOB"
|
|
146
|
+
return "CLOB"
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def resolve_oracle_feature_flag(
|
|
150
|
+
config: DialectConfig,
|
|
151
|
+
version_info: "VersionInfo | None",
|
|
152
|
+
feature: str,
|
|
153
|
+
*,
|
|
154
|
+
compatible_major: "int | None",
|
|
155
|
+
is_autonomous: bool,
|
|
156
|
+
) -> bool:
|
|
157
|
+
"""Resolve an Oracle feature flag from static config and version details."""
|
|
158
|
+
if feature == "is_autonomous":
|
|
159
|
+
return bool(version_info and is_autonomous)
|
|
160
|
+
if version_info is None:
|
|
161
|
+
return False
|
|
162
|
+
if feature == "supports_native_json":
|
|
163
|
+
return oracle_supports_native_json(version_info.major, compatible_major)
|
|
164
|
+
if feature == "supports_oson_blob":
|
|
165
|
+
return oracle_supports_oson_blob(version_info.major, is_autonomous)
|
|
166
|
+
if feature == "supports_json_blob":
|
|
167
|
+
return oracle_supports_json_blob(version_info.major)
|
|
168
|
+
if feature == "supports_json":
|
|
169
|
+
return oracle_supports_json_blob(version_info.major)
|
|
170
|
+
|
|
171
|
+
flag = config.get_feature_flag(feature)
|
|
172
|
+
if flag is not None:
|
|
173
|
+
return flag
|
|
174
|
+
required_version = config.get_feature_version(feature)
|
|
175
|
+
if required_version is None:
|
|
176
|
+
return False
|
|
177
|
+
return bool(version_info >= required_version)
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def list_oracle_available_features(config: DialectConfig) -> "list[str]":
|
|
181
|
+
"""List static and dynamic Oracle data-dictionary feature flags."""
|
|
182
|
+
features: set[str] = set()
|
|
183
|
+
features.update(config.feature_flags.keys())
|
|
184
|
+
features.update(config.feature_versions.keys())
|
|
185
|
+
features.update(ORACLE_DYNAMIC_FEATURES)
|
|
186
|
+
return sorted(features)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def merge_oracle_table_lists(
|
|
190
|
+
ordered: "list[TableMetadata]", all_tables: "list[TableMetadata]"
|
|
191
|
+
) -> "list[TableMetadata]":
|
|
192
|
+
"""Merge dependency-ordered Oracle tables with unordered remainder rows."""
|
|
193
|
+
if not ordered:
|
|
194
|
+
return sorted(all_tables, key=lambda item: item.get("table_name") or "")
|
|
195
|
+
ordered_names = {item.get("table_name") for item in ordered if item.get("table_name")}
|
|
196
|
+
remainder = [item for item in all_tables if item.get("table_name") not in ordered_names]
|
|
197
|
+
return ordered + remainder
|
|
Binary file
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from sqlspec.data_dictionary import DialectConfig, FeatureFlags, FeatureVersions, register_dialect
|
|
4
|
+
from sqlspec.typing import VersionInfo
|
|
5
|
+
|
|
6
|
+
__all__ = ("resolve_postgres_json_type",)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
POSTGRES_VERSION_PATTERN = re.compile(r"PostgreSQL (\d+)\.(\d+)(?:\.(\d+))?")
|
|
10
|
+
|
|
11
|
+
POSTGRES_FEATURE_VERSIONS: "FeatureVersions" = {
|
|
12
|
+
"supports_json": VersionInfo(9, 2, 0),
|
|
13
|
+
"supports_jsonb": VersionInfo(9, 4, 0),
|
|
14
|
+
"supports_returning": VersionInfo(8, 2, 0),
|
|
15
|
+
"supports_upsert": VersionInfo(9, 5, 0),
|
|
16
|
+
"supports_window_functions": VersionInfo(8, 4, 0),
|
|
17
|
+
"supports_cte": VersionInfo(8, 4, 0),
|
|
18
|
+
"supports_partitioning": VersionInfo(10, 0, 0),
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
POSTGRES_FEATURE_FLAGS: "FeatureFlags" = {
|
|
22
|
+
"supports_uuid": True,
|
|
23
|
+
"supports_arrays": True,
|
|
24
|
+
"supports_transactions": True,
|
|
25
|
+
"supports_prepared_statements": True,
|
|
26
|
+
"supports_schemas": True,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
POSTGRES_TYPE_MAPPINGS: dict[str, str] = {
|
|
30
|
+
"uuid": "UUID",
|
|
31
|
+
"boolean": "BOOLEAN",
|
|
32
|
+
"timestamp": "TIMESTAMP WITH TIME ZONE",
|
|
33
|
+
"text": "TEXT",
|
|
34
|
+
"blob": "BYTEA",
|
|
35
|
+
"array": "ARRAY",
|
|
36
|
+
"json": "JSONB",
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
POSTGRES_CONFIG = DialectConfig(
|
|
41
|
+
name="postgres",
|
|
42
|
+
feature_versions=POSTGRES_FEATURE_VERSIONS,
|
|
43
|
+
feature_flags=POSTGRES_FEATURE_FLAGS,
|
|
44
|
+
type_mappings=POSTGRES_TYPE_MAPPINGS,
|
|
45
|
+
version_pattern=POSTGRES_VERSION_PATTERN,
|
|
46
|
+
default_schema="public",
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
register_dialect(POSTGRES_CONFIG)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def resolve_postgres_json_type(version_info: "VersionInfo | None") -> str:
|
|
53
|
+
"""Resolve the best PostgreSQL JSON storage type for a database version.
|
|
54
|
+
|
|
55
|
+
Args:
|
|
56
|
+
version_info: Parsed PostgreSQL version, or None when version detection failed.
|
|
57
|
+
|
|
58
|
+
Returns:
|
|
59
|
+
JSONB when available, JSON before JSONB support, otherwise TEXT.
|
|
60
|
+
"""
|
|
61
|
+
jsonb_version = POSTGRES_CONFIG.get_feature_version("supports_jsonb")
|
|
62
|
+
if version_info and jsonb_version and version_info >= jsonb_version:
|
|
63
|
+
return "JSONB"
|
|
64
|
+
|
|
65
|
+
json_version = POSTGRES_CONFIG.get_feature_version("supports_json")
|
|
66
|
+
if version_info and json_version and version_info >= json_version:
|
|
67
|
+
return "JSON"
|
|
68
|
+
|
|
69
|
+
return "TEXT"
|
|
Binary file
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from sqlspec.data_dictionary import DialectConfig, FeatureFlags, FeatureVersions, register_dialect
|
|
4
|
+
|
|
5
|
+
SPANNER_VERSION_PATTERN = re.compile(r".*")
|
|
6
|
+
|
|
7
|
+
SPANNER_FEATURE_VERSIONS: "FeatureVersions" = {}
|
|
8
|
+
|
|
9
|
+
SPANNER_FEATURE_FLAGS: "FeatureFlags" = {
|
|
10
|
+
"supports_json": True,
|
|
11
|
+
"supports_generators": False,
|
|
12
|
+
"supports_index_clustering": True,
|
|
13
|
+
"supports_interleaved_tables": True,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
SPANNER_TYPE_MAPPINGS: dict[str, str] = {
|
|
17
|
+
"json": "JSON",
|
|
18
|
+
"uuid": "BYTES(16)",
|
|
19
|
+
"boolean": "BOOL",
|
|
20
|
+
"timestamp": "TIMESTAMP",
|
|
21
|
+
"text": "STRING(MAX)",
|
|
22
|
+
"blob": "BYTES(MAX)",
|
|
23
|
+
"numeric": "NUMERIC",
|
|
24
|
+
"bignumeric": "NUMERIC",
|
|
25
|
+
"array": "ARRAY",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
SPANNER_CONFIG = DialectConfig(
|
|
30
|
+
name="spanner",
|
|
31
|
+
feature_versions=SPANNER_FEATURE_VERSIONS,
|
|
32
|
+
feature_flags=SPANNER_FEATURE_FLAGS,
|
|
33
|
+
type_mappings=SPANNER_TYPE_MAPPINGS,
|
|
34
|
+
version_pattern=SPANNER_VERSION_PATTERN,
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
register_dialect(SPANNER_CONFIG)
|
|
Binary file
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import re
|
|
2
|
+
|
|
3
|
+
from sqlspec.data_dictionary import DialectConfig, FeatureFlags, FeatureVersions, register_dialect
|
|
4
|
+
from sqlspec.typing import VersionInfo
|
|
5
|
+
|
|
6
|
+
__all__ = ("list_sqlite_available_features", "resolve_sqlite_json_type")
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
SQLITE_VERSION_PATTERN = re.compile(r"(\d+)\.(\d+)\.(\d+)")
|
|
10
|
+
|
|
11
|
+
SQLITE_FEATURE_VERSIONS: "FeatureVersions" = {
|
|
12
|
+
"supports_json": VersionInfo(3, 38, 0),
|
|
13
|
+
"supports_returning": VersionInfo(3, 35, 0),
|
|
14
|
+
"supports_upsert": VersionInfo(3, 24, 0),
|
|
15
|
+
"supports_window_functions": VersionInfo(3, 25, 0),
|
|
16
|
+
"supports_cte": VersionInfo(3, 8, 3),
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
SQLITE_FEATURE_FLAGS: "FeatureFlags" = {
|
|
20
|
+
"supports_transactions": True,
|
|
21
|
+
"supports_prepared_statements": True,
|
|
22
|
+
"supports_schemas": False,
|
|
23
|
+
"supports_arrays": False,
|
|
24
|
+
"supports_uuid": False,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
SQLITE_TYPE_MAPPINGS: dict[str, str] = {
|
|
28
|
+
"uuid": "TEXT",
|
|
29
|
+
"boolean": "INTEGER",
|
|
30
|
+
"timestamp": "TIMESTAMP",
|
|
31
|
+
"text": "TEXT",
|
|
32
|
+
"blob": "BLOB",
|
|
33
|
+
"json": "JSON",
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
SQLITE_CONFIG = DialectConfig(
|
|
38
|
+
name="sqlite",
|
|
39
|
+
feature_versions=SQLITE_FEATURE_VERSIONS,
|
|
40
|
+
feature_flags=SQLITE_FEATURE_FLAGS,
|
|
41
|
+
type_mappings=SQLITE_TYPE_MAPPINGS,
|
|
42
|
+
version_pattern=SQLITE_VERSION_PATTERN,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
register_dialect(SQLITE_CONFIG)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def resolve_sqlite_json_type(version_info: "VersionInfo | None") -> str:
|
|
49
|
+
"""Resolve the best SQLite JSON storage type for a database version."""
|
|
50
|
+
json_version = SQLITE_CONFIG.get_feature_version("supports_json")
|
|
51
|
+
if version_info and json_version and version_info >= json_version:
|
|
52
|
+
return "JSON"
|
|
53
|
+
return "TEXT"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def list_sqlite_available_features() -> "list[str]":
|
|
57
|
+
"""List SQLite data-dictionary feature flags."""
|
|
58
|
+
features = set(SQLITE_CONFIG.feature_flags.keys()) | set(SQLITE_CONFIG.feature_versions.keys())
|
|
59
|
+
return sorted(features)
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- name: columns_by_table
|
|
2
|
+
-- dialect: bigquery
|
|
3
|
+
SELECT
|
|
4
|
+
column_name,
|
|
5
|
+
data_type,
|
|
6
|
+
is_nullable,
|
|
7
|
+
column_default
|
|
8
|
+
FROM {schema_prefix}INFORMATION_SCHEMA.COLUMNS
|
|
9
|
+
WHERE table_name = :table_name
|
|
10
|
+
AND (:schema_name IS NULL OR table_schema = :schema_name)
|
|
11
|
+
ORDER BY ordinal_position;
|
|
12
|
+
|
|
13
|
+
-- name: columns_by_schema
|
|
14
|
+
-- dialect: bigquery
|
|
15
|
+
SELECT
|
|
16
|
+
table_name,
|
|
17
|
+
column_name,
|
|
18
|
+
data_type,
|
|
19
|
+
is_nullable,
|
|
20
|
+
column_default
|
|
21
|
+
FROM {schema_prefix}INFORMATION_SCHEMA.COLUMNS
|
|
22
|
+
WHERE (:schema_name IS NULL OR table_schema = :schema_name)
|
|
23
|
+
ORDER BY table_name, ordinal_position;
|