sqlspec 0.36.0__cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ac8f31065839703b4e70__mypyc.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/__init__.py +140 -0
- sqlspec/__main__.py +12 -0
- sqlspec/__metadata__.py +14 -0
- sqlspec/_serialization.py +315 -0
- sqlspec/_typing.py +700 -0
- sqlspec/adapters/__init__.py +0 -0
- sqlspec/adapters/adbc/__init__.py +5 -0
- sqlspec/adapters/adbc/_typing.py +82 -0
- sqlspec/adapters/adbc/adk/__init__.py +5 -0
- sqlspec/adapters/adbc/adk/store.py +1273 -0
- sqlspec/adapters/adbc/config.py +295 -0
- sqlspec/adapters/adbc/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/adbc/core.py +735 -0
- sqlspec/adapters/adbc/data_dictionary.py +334 -0
- sqlspec/adapters/adbc/driver.py +529 -0
- sqlspec/adapters/adbc/events/__init__.py +5 -0
- sqlspec/adapters/adbc/events/store.py +285 -0
- sqlspec/adapters/adbc/litestar/__init__.py +5 -0
- sqlspec/adapters/adbc/litestar/store.py +502 -0
- sqlspec/adapters/adbc/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/adbc/type_converter.py +140 -0
- sqlspec/adapters/aiosqlite/__init__.py +25 -0
- sqlspec/adapters/aiosqlite/_typing.py +82 -0
- sqlspec/adapters/aiosqlite/adk/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/adk/store.py +818 -0
- sqlspec/adapters/aiosqlite/config.py +334 -0
- sqlspec/adapters/aiosqlite/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/aiosqlite/core.py +315 -0
- sqlspec/adapters/aiosqlite/data_dictionary.py +208 -0
- sqlspec/adapters/aiosqlite/driver.py +313 -0
- sqlspec/adapters/aiosqlite/events/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/events/store.py +20 -0
- sqlspec/adapters/aiosqlite/litestar/__init__.py +5 -0
- sqlspec/adapters/aiosqlite/litestar/store.py +279 -0
- sqlspec/adapters/aiosqlite/pool.py +533 -0
- sqlspec/adapters/asyncmy/__init__.py +21 -0
- sqlspec/adapters/asyncmy/_typing.py +87 -0
- sqlspec/adapters/asyncmy/adk/__init__.py +5 -0
- sqlspec/adapters/asyncmy/adk/store.py +703 -0
- sqlspec/adapters/asyncmy/config.py +302 -0
- sqlspec/adapters/asyncmy/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/asyncmy/core.py +360 -0
- sqlspec/adapters/asyncmy/data_dictionary.py +124 -0
- sqlspec/adapters/asyncmy/driver.py +383 -0
- sqlspec/adapters/asyncmy/events/__init__.py +5 -0
- sqlspec/adapters/asyncmy/events/store.py +104 -0
- sqlspec/adapters/asyncmy/litestar/__init__.py +5 -0
- sqlspec/adapters/asyncmy/litestar/store.py +296 -0
- sqlspec/adapters/asyncpg/__init__.py +19 -0
- sqlspec/adapters/asyncpg/_typing.py +88 -0
- sqlspec/adapters/asyncpg/adk/__init__.py +5 -0
- sqlspec/adapters/asyncpg/adk/store.py +748 -0
- sqlspec/adapters/asyncpg/config.py +569 -0
- sqlspec/adapters/asyncpg/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/asyncpg/core.py +367 -0
- sqlspec/adapters/asyncpg/data_dictionary.py +162 -0
- sqlspec/adapters/asyncpg/driver.py +487 -0
- sqlspec/adapters/asyncpg/events/__init__.py +6 -0
- sqlspec/adapters/asyncpg/events/backend.py +286 -0
- sqlspec/adapters/asyncpg/events/store.py +40 -0
- sqlspec/adapters/asyncpg/litestar/__init__.py +5 -0
- sqlspec/adapters/asyncpg/litestar/store.py +251 -0
- sqlspec/adapters/bigquery/__init__.py +14 -0
- sqlspec/adapters/bigquery/_typing.py +86 -0
- sqlspec/adapters/bigquery/adk/__init__.py +5 -0
- sqlspec/adapters/bigquery/adk/store.py +827 -0
- sqlspec/adapters/bigquery/config.py +353 -0
- sqlspec/adapters/bigquery/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/bigquery/core.py +715 -0
- sqlspec/adapters/bigquery/data_dictionary.py +128 -0
- sqlspec/adapters/bigquery/driver.py +548 -0
- sqlspec/adapters/bigquery/events/__init__.py +5 -0
- sqlspec/adapters/bigquery/events/store.py +139 -0
- sqlspec/adapters/bigquery/litestar/__init__.py +5 -0
- sqlspec/adapters/bigquery/litestar/store.py +325 -0
- sqlspec/adapters/bigquery/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/bigquery/type_converter.py +107 -0
- sqlspec/adapters/cockroach_asyncpg/__init__.py +24 -0
- sqlspec/adapters/cockroach_asyncpg/_typing.py +72 -0
- sqlspec/adapters/cockroach_asyncpg/adk/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/adk/store.py +410 -0
- sqlspec/adapters/cockroach_asyncpg/config.py +238 -0
- sqlspec/adapters/cockroach_asyncpg/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/cockroach_asyncpg/core.py +55 -0
- sqlspec/adapters/cockroach_asyncpg/data_dictionary.py +107 -0
- sqlspec/adapters/cockroach_asyncpg/driver.py +144 -0
- sqlspec/adapters/cockroach_asyncpg/events/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/events/store.py +20 -0
- sqlspec/adapters/cockroach_asyncpg/litestar/__init__.py +3 -0
- sqlspec/adapters/cockroach_asyncpg/litestar/store.py +142 -0
- sqlspec/adapters/cockroach_psycopg/__init__.py +38 -0
- sqlspec/adapters/cockroach_psycopg/_typing.py +129 -0
- sqlspec/adapters/cockroach_psycopg/adk/__init__.py +13 -0
- sqlspec/adapters/cockroach_psycopg/adk/store.py +868 -0
- sqlspec/adapters/cockroach_psycopg/config.py +484 -0
- sqlspec/adapters/cockroach_psycopg/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/cockroach_psycopg/core.py +63 -0
- sqlspec/adapters/cockroach_psycopg/data_dictionary.py +215 -0
- sqlspec/adapters/cockroach_psycopg/driver.py +284 -0
- sqlspec/adapters/cockroach_psycopg/events/__init__.py +6 -0
- sqlspec/adapters/cockroach_psycopg/events/store.py +34 -0
- sqlspec/adapters/cockroach_psycopg/litestar/__init__.py +3 -0
- sqlspec/adapters/cockroach_psycopg/litestar/store.py +325 -0
- sqlspec/adapters/duckdb/__init__.py +25 -0
- sqlspec/adapters/duckdb/_typing.py +81 -0
- sqlspec/adapters/duckdb/adk/__init__.py +14 -0
- sqlspec/adapters/duckdb/adk/store.py +850 -0
- sqlspec/adapters/duckdb/config.py +463 -0
- sqlspec/adapters/duckdb/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/duckdb/core.py +257 -0
- sqlspec/adapters/duckdb/data_dictionary.py +140 -0
- sqlspec/adapters/duckdb/driver.py +430 -0
- sqlspec/adapters/duckdb/events/__init__.py +5 -0
- sqlspec/adapters/duckdb/events/store.py +57 -0
- sqlspec/adapters/duckdb/litestar/__init__.py +5 -0
- sqlspec/adapters/duckdb/litestar/store.py +330 -0
- sqlspec/adapters/duckdb/pool.py +293 -0
- sqlspec/adapters/duckdb/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/duckdb/type_converter.py +118 -0
- sqlspec/adapters/mock/__init__.py +72 -0
- sqlspec/adapters/mock/_typing.py +147 -0
- sqlspec/adapters/mock/config.py +483 -0
- sqlspec/adapters/mock/core.py +319 -0
- sqlspec/adapters/mock/data_dictionary.py +366 -0
- sqlspec/adapters/mock/driver.py +721 -0
- sqlspec/adapters/mysqlconnector/__init__.py +36 -0
- sqlspec/adapters/mysqlconnector/_typing.py +141 -0
- sqlspec/adapters/mysqlconnector/adk/__init__.py +15 -0
- sqlspec/adapters/mysqlconnector/adk/store.py +1060 -0
- sqlspec/adapters/mysqlconnector/config.py +394 -0
- sqlspec/adapters/mysqlconnector/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/mysqlconnector/core.py +303 -0
- sqlspec/adapters/mysqlconnector/data_dictionary.py +235 -0
- sqlspec/adapters/mysqlconnector/driver.py +483 -0
- sqlspec/adapters/mysqlconnector/events/__init__.py +8 -0
- sqlspec/adapters/mysqlconnector/events/store.py +98 -0
- sqlspec/adapters/mysqlconnector/litestar/__init__.py +5 -0
- sqlspec/adapters/mysqlconnector/litestar/store.py +426 -0
- sqlspec/adapters/oracledb/__init__.py +60 -0
- sqlspec/adapters/oracledb/_numpy_handlers.py +141 -0
- sqlspec/adapters/oracledb/_typing.py +182 -0
- sqlspec/adapters/oracledb/_uuid_handlers.py +166 -0
- sqlspec/adapters/oracledb/adk/__init__.py +10 -0
- sqlspec/adapters/oracledb/adk/store.py +2369 -0
- sqlspec/adapters/oracledb/config.py +550 -0
- sqlspec/adapters/oracledb/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/oracledb/core.py +543 -0
- sqlspec/adapters/oracledb/data_dictionary.py +536 -0
- sqlspec/adapters/oracledb/driver.py +1229 -0
- sqlspec/adapters/oracledb/events/__init__.py +16 -0
- sqlspec/adapters/oracledb/events/backend.py +347 -0
- sqlspec/adapters/oracledb/events/store.py +420 -0
- sqlspec/adapters/oracledb/litestar/__init__.py +5 -0
- sqlspec/adapters/oracledb/litestar/store.py +781 -0
- sqlspec/adapters/oracledb/migrations.py +535 -0
- sqlspec/adapters/oracledb/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/oracledb/type_converter.py +211 -0
- sqlspec/adapters/psqlpy/__init__.py +17 -0
- sqlspec/adapters/psqlpy/_typing.py +79 -0
- sqlspec/adapters/psqlpy/adk/__init__.py +5 -0
- sqlspec/adapters/psqlpy/adk/store.py +766 -0
- sqlspec/adapters/psqlpy/config.py +304 -0
- sqlspec/adapters/psqlpy/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/psqlpy/core.py +480 -0
- sqlspec/adapters/psqlpy/data_dictionary.py +126 -0
- sqlspec/adapters/psqlpy/driver.py +438 -0
- sqlspec/adapters/psqlpy/events/__init__.py +6 -0
- sqlspec/adapters/psqlpy/events/backend.py +310 -0
- sqlspec/adapters/psqlpy/events/store.py +20 -0
- sqlspec/adapters/psqlpy/litestar/__init__.py +5 -0
- sqlspec/adapters/psqlpy/litestar/store.py +270 -0
- sqlspec/adapters/psqlpy/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/psqlpy/type_converter.py +113 -0
- sqlspec/adapters/psycopg/__init__.py +32 -0
- sqlspec/adapters/psycopg/_typing.py +164 -0
- sqlspec/adapters/psycopg/adk/__init__.py +10 -0
- sqlspec/adapters/psycopg/adk/store.py +1387 -0
- sqlspec/adapters/psycopg/config.py +576 -0
- sqlspec/adapters/psycopg/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/psycopg/core.py +450 -0
- sqlspec/adapters/psycopg/data_dictionary.py +289 -0
- sqlspec/adapters/psycopg/driver.py +975 -0
- sqlspec/adapters/psycopg/events/__init__.py +20 -0
- sqlspec/adapters/psycopg/events/backend.py +458 -0
- sqlspec/adapters/psycopg/events/store.py +42 -0
- sqlspec/adapters/psycopg/litestar/__init__.py +5 -0
- sqlspec/adapters/psycopg/litestar/store.py +552 -0
- sqlspec/adapters/psycopg/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/psycopg/type_converter.py +93 -0
- sqlspec/adapters/pymysql/__init__.py +21 -0
- sqlspec/adapters/pymysql/_typing.py +71 -0
- sqlspec/adapters/pymysql/adk/__init__.py +5 -0
- sqlspec/adapters/pymysql/adk/store.py +540 -0
- sqlspec/adapters/pymysql/config.py +195 -0
- sqlspec/adapters/pymysql/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/pymysql/core.py +299 -0
- sqlspec/adapters/pymysql/data_dictionary.py +122 -0
- sqlspec/adapters/pymysql/driver.py +259 -0
- sqlspec/adapters/pymysql/events/__init__.py +5 -0
- sqlspec/adapters/pymysql/events/store.py +50 -0
- sqlspec/adapters/pymysql/litestar/__init__.py +5 -0
- sqlspec/adapters/pymysql/litestar/store.py +232 -0
- sqlspec/adapters/pymysql/pool.py +137 -0
- sqlspec/adapters/spanner/__init__.py +40 -0
- sqlspec/adapters/spanner/_typing.py +86 -0
- sqlspec/adapters/spanner/adk/__init__.py +5 -0
- sqlspec/adapters/spanner/adk/store.py +732 -0
- sqlspec/adapters/spanner/config.py +352 -0
- sqlspec/adapters/spanner/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/spanner/core.py +188 -0
- sqlspec/adapters/spanner/data_dictionary.py +120 -0
- sqlspec/adapters/spanner/dialect/__init__.py +6 -0
- sqlspec/adapters/spanner/dialect/_spangres.py +57 -0
- sqlspec/adapters/spanner/dialect/_spanner.py +130 -0
- sqlspec/adapters/spanner/driver.py +373 -0
- sqlspec/adapters/spanner/events/__init__.py +5 -0
- sqlspec/adapters/spanner/events/store.py +187 -0
- sqlspec/adapters/spanner/litestar/__init__.py +5 -0
- sqlspec/adapters/spanner/litestar/store.py +291 -0
- sqlspec/adapters/spanner/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/spanner/type_converter.py +331 -0
- sqlspec/adapters/sqlite/__init__.py +19 -0
- sqlspec/adapters/sqlite/_typing.py +80 -0
- sqlspec/adapters/sqlite/adk/__init__.py +5 -0
- sqlspec/adapters/sqlite/adk/store.py +958 -0
- sqlspec/adapters/sqlite/config.py +280 -0
- sqlspec/adapters/sqlite/core.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/sqlite/core.py +312 -0
- sqlspec/adapters/sqlite/data_dictionary.py +202 -0
- sqlspec/adapters/sqlite/driver.py +359 -0
- sqlspec/adapters/sqlite/events/__init__.py +5 -0
- sqlspec/adapters/sqlite/events/store.py +20 -0
- sqlspec/adapters/sqlite/litestar/__init__.py +5 -0
- sqlspec/adapters/sqlite/litestar/store.py +316 -0
- sqlspec/adapters/sqlite/pool.py +198 -0
- sqlspec/adapters/sqlite/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/adapters/sqlite/type_converter.py +114 -0
- sqlspec/base.py +747 -0
- sqlspec/builder/__init__.py +179 -0
- sqlspec/builder/_base.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_base.py +1022 -0
- sqlspec/builder/_column.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_column.py +521 -0
- sqlspec/builder/_ddl.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_ddl.py +1642 -0
- sqlspec/builder/_delete.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_delete.py +95 -0
- sqlspec/builder/_dml.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_dml.py +365 -0
- sqlspec/builder/_explain.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_explain.py +579 -0
- sqlspec/builder/_expression_wrappers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_expression_wrappers.py +46 -0
- sqlspec/builder/_factory.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_factory.py +1697 -0
- sqlspec/builder/_insert.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_insert.py +328 -0
- sqlspec/builder/_join.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_join.py +499 -0
- sqlspec/builder/_merge.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_merge.py +821 -0
- sqlspec/builder/_parsing_utils.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_parsing_utils.py +297 -0
- sqlspec/builder/_select.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_select.py +1660 -0
- sqlspec/builder/_temporal.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_temporal.py +139 -0
- sqlspec/builder/_update.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/builder/_update.py +173 -0
- sqlspec/builder/_vector_expressions.py +267 -0
- sqlspec/cli.py +911 -0
- sqlspec/config.py +1755 -0
- sqlspec/core/__init__.py +374 -0
- sqlspec/core/_correlation.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/_correlation.py +176 -0
- sqlspec/core/cache.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/cache.py +1069 -0
- sqlspec/core/compiler.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/compiler.py +954 -0
- sqlspec/core/explain.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/explain.py +275 -0
- sqlspec/core/filters.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/filters.py +952 -0
- sqlspec/core/hashing.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/hashing.py +262 -0
- sqlspec/core/metrics.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/metrics.py +83 -0
- sqlspec/core/parameters/__init__.py +71 -0
- sqlspec/core/parameters/_alignment.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_alignment.py +270 -0
- sqlspec/core/parameters/_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_converter.py +543 -0
- sqlspec/core/parameters/_processor.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_processor.py +505 -0
- sqlspec/core/parameters/_registry.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_registry.py +206 -0
- sqlspec/core/parameters/_transformers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_transformers.py +292 -0
- sqlspec/core/parameters/_types.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_types.py +499 -0
- sqlspec/core/parameters/_validator.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/parameters/_validator.py +180 -0
- sqlspec/core/pipeline.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/pipeline.py +319 -0
- sqlspec/core/query_modifiers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/query_modifiers.py +437 -0
- sqlspec/core/result/__init__.py +23 -0
- sqlspec/core/result/_base.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/result/_base.py +1121 -0
- sqlspec/core/result/_io.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/result/_io.py +28 -0
- sqlspec/core/splitter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/splitter.py +966 -0
- sqlspec/core/stack.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/stack.py +163 -0
- sqlspec/core/statement.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/statement.py +1503 -0
- sqlspec/core/type_converter.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/core/type_converter.py +339 -0
- sqlspec/data_dictionary/__init__.py +22 -0
- sqlspec/data_dictionary/_loader.py +123 -0
- sqlspec/data_dictionary/_registry.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/_registry.py +74 -0
- sqlspec/data_dictionary/_types.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/_types.py +121 -0
- sqlspec/data_dictionary/dialects/__init__.py +21 -0
- sqlspec/data_dictionary/dialects/bigquery.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/bigquery.py +49 -0
- sqlspec/data_dictionary/dialects/cockroachdb.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/cockroachdb.py +43 -0
- sqlspec/data_dictionary/dialects/duckdb.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/duckdb.py +47 -0
- sqlspec/data_dictionary/dialects/mysql.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/mysql.py +42 -0
- sqlspec/data_dictionary/dialects/oracle.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/oracle.py +34 -0
- sqlspec/data_dictionary/dialects/postgres.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/postgres.py +46 -0
- sqlspec/data_dictionary/dialects/spanner.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/spanner.py +37 -0
- sqlspec/data_dictionary/dialects/sqlite.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/data_dictionary/dialects/sqlite.py +42 -0
- sqlspec/data_dictionary/sql/.gitkeep +0 -0
- sqlspec/data_dictionary/sql/bigquery/columns.sql +23 -0
- sqlspec/data_dictionary/sql/bigquery/foreign_keys.sql +34 -0
- sqlspec/data_dictionary/sql/bigquery/indexes.sql +19 -0
- sqlspec/data_dictionary/sql/bigquery/tables.sql +33 -0
- sqlspec/data_dictionary/sql/bigquery/version.sql +3 -0
- sqlspec/data_dictionary/sql/cockroachdb/columns.sql +34 -0
- sqlspec/data_dictionary/sql/cockroachdb/foreign_keys.sql +40 -0
- sqlspec/data_dictionary/sql/cockroachdb/indexes.sql +32 -0
- sqlspec/data_dictionary/sql/cockroachdb/tables.sql +44 -0
- sqlspec/data_dictionary/sql/cockroachdb/version.sql +3 -0
- sqlspec/data_dictionary/sql/duckdb/columns.sql +23 -0
- sqlspec/data_dictionary/sql/duckdb/foreign_keys.sql +36 -0
- sqlspec/data_dictionary/sql/duckdb/indexes.sql +19 -0
- sqlspec/data_dictionary/sql/duckdb/tables.sql +38 -0
- sqlspec/data_dictionary/sql/duckdb/version.sql +3 -0
- sqlspec/data_dictionary/sql/mysql/columns.sql +23 -0
- sqlspec/data_dictionary/sql/mysql/foreign_keys.sql +28 -0
- sqlspec/data_dictionary/sql/mysql/indexes.sql +26 -0
- sqlspec/data_dictionary/sql/mysql/tables.sql +33 -0
- sqlspec/data_dictionary/sql/mysql/version.sql +3 -0
- sqlspec/data_dictionary/sql/oracle/columns.sql +23 -0
- sqlspec/data_dictionary/sql/oracle/foreign_keys.sql +48 -0
- sqlspec/data_dictionary/sql/oracle/indexes.sql +44 -0
- sqlspec/data_dictionary/sql/oracle/tables.sql +25 -0
- sqlspec/data_dictionary/sql/oracle/version.sql +20 -0
- sqlspec/data_dictionary/sql/postgres/columns.sql +34 -0
- sqlspec/data_dictionary/sql/postgres/foreign_keys.sql +40 -0
- sqlspec/data_dictionary/sql/postgres/indexes.sql +56 -0
- sqlspec/data_dictionary/sql/postgres/tables.sql +44 -0
- sqlspec/data_dictionary/sql/postgres/version.sql +3 -0
- sqlspec/data_dictionary/sql/spanner/columns.sql +23 -0
- sqlspec/data_dictionary/sql/spanner/foreign_keys.sql +70 -0
- sqlspec/data_dictionary/sql/spanner/indexes.sql +30 -0
- sqlspec/data_dictionary/sql/spanner/tables.sql +9 -0
- sqlspec/data_dictionary/sql/spanner/version.sql +3 -0
- sqlspec/data_dictionary/sql/sqlite/columns.sql +23 -0
- sqlspec/data_dictionary/sql/sqlite/foreign_keys.sql +22 -0
- sqlspec/data_dictionary/sql/sqlite/indexes.sql +7 -0
- sqlspec/data_dictionary/sql/sqlite/tables.sql +28 -0
- sqlspec/data_dictionary/sql/sqlite/version.sql +3 -0
- sqlspec/driver/__init__.py +32 -0
- sqlspec/driver/_async.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_async.py +1737 -0
- sqlspec/driver/_common.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_common.py +1478 -0
- sqlspec/driver/_sql_helpers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_sql_helpers.py +148 -0
- sqlspec/driver/_storage_helpers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_storage_helpers.py +144 -0
- sqlspec/driver/_sync.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/driver/_sync.py +1710 -0
- sqlspec/exceptions.py +338 -0
- sqlspec/extensions/__init__.py +0 -0
- sqlspec/extensions/adk/__init__.py +70 -0
- sqlspec/extensions/adk/_types.py +51 -0
- sqlspec/extensions/adk/converters.py +172 -0
- sqlspec/extensions/adk/memory/__init__.py +69 -0
- sqlspec/extensions/adk/memory/_types.py +30 -0
- sqlspec/extensions/adk/memory/converters.py +149 -0
- sqlspec/extensions/adk/memory/service.py +217 -0
- sqlspec/extensions/adk/memory/store.py +569 -0
- sqlspec/extensions/adk/migrations/0001_create_adk_tables.py +246 -0
- sqlspec/extensions/adk/migrations/__init__.py +0 -0
- sqlspec/extensions/adk/service.py +225 -0
- sqlspec/extensions/adk/store.py +567 -0
- sqlspec/extensions/events/__init__.py +51 -0
- sqlspec/extensions/events/_channel.py +703 -0
- sqlspec/extensions/events/_hints.py +45 -0
- sqlspec/extensions/events/_models.py +23 -0
- sqlspec/extensions/events/_payload.py +69 -0
- sqlspec/extensions/events/_protocols.py +134 -0
- sqlspec/extensions/events/_queue.py +461 -0
- sqlspec/extensions/events/_store.py +209 -0
- sqlspec/extensions/events/migrations/0001_create_event_queue.py +59 -0
- sqlspec/extensions/events/migrations/__init__.py +3 -0
- sqlspec/extensions/fastapi/__init__.py +19 -0
- sqlspec/extensions/fastapi/extension.py +351 -0
- sqlspec/extensions/fastapi/providers.py +607 -0
- sqlspec/extensions/flask/__init__.py +37 -0
- sqlspec/extensions/flask/_state.py +76 -0
- sqlspec/extensions/flask/_utils.py +71 -0
- sqlspec/extensions/flask/extension.py +519 -0
- sqlspec/extensions/litestar/__init__.py +28 -0
- sqlspec/extensions/litestar/_utils.py +52 -0
- sqlspec/extensions/litestar/channels.py +165 -0
- sqlspec/extensions/litestar/cli.py +102 -0
- sqlspec/extensions/litestar/config.py +90 -0
- sqlspec/extensions/litestar/handlers.py +316 -0
- sqlspec/extensions/litestar/migrations/0001_create_session_table.py +137 -0
- sqlspec/extensions/litestar/migrations/__init__.py +3 -0
- sqlspec/extensions/litestar/plugin.py +671 -0
- sqlspec/extensions/litestar/providers.py +526 -0
- sqlspec/extensions/litestar/store.py +296 -0
- sqlspec/extensions/otel/__init__.py +58 -0
- sqlspec/extensions/prometheus/__init__.py +113 -0
- sqlspec/extensions/starlette/__init__.py +19 -0
- sqlspec/extensions/starlette/_state.py +30 -0
- sqlspec/extensions/starlette/_utils.py +96 -0
- sqlspec/extensions/starlette/extension.py +346 -0
- sqlspec/extensions/starlette/middleware.py +235 -0
- sqlspec/loader.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/loader.py +702 -0
- sqlspec/migrations/__init__.py +36 -0
- sqlspec/migrations/base.py +731 -0
- sqlspec/migrations/commands.py +1232 -0
- sqlspec/migrations/context.py +157 -0
- sqlspec/migrations/fix.py +204 -0
- sqlspec/migrations/loaders.py +443 -0
- sqlspec/migrations/runner.py +1172 -0
- sqlspec/migrations/templates.py +234 -0
- sqlspec/migrations/tracker.py +611 -0
- sqlspec/migrations/utils.py +256 -0
- sqlspec/migrations/validation.py +207 -0
- sqlspec/migrations/version.py +446 -0
- sqlspec/observability/__init__.py +55 -0
- sqlspec/observability/_common.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_common.py +77 -0
- sqlspec/observability/_config.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_config.py +348 -0
- sqlspec/observability/_diagnostics.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_diagnostics.py +74 -0
- sqlspec/observability/_dispatcher.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_dispatcher.py +152 -0
- sqlspec/observability/_formatters/__init__.py +13 -0
- sqlspec/observability/_formatters/_aws.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_formatters/_aws.py +102 -0
- sqlspec/observability/_formatters/_azure.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_formatters/_azure.py +96 -0
- sqlspec/observability/_formatters/_base.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_formatters/_base.py +57 -0
- sqlspec/observability/_formatters/_gcp.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_formatters/_gcp.py +131 -0
- sqlspec/observability/_formatting.py +58 -0
- sqlspec/observability/_observer.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_observer.py +357 -0
- sqlspec/observability/_runtime.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_runtime.py +420 -0
- sqlspec/observability/_sampling.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_sampling.py +188 -0
- sqlspec/observability/_spans.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/observability/_spans.py +161 -0
- sqlspec/protocols.py +916 -0
- sqlspec/py.typed +0 -0
- sqlspec/storage/__init__.py +48 -0
- sqlspec/storage/_utils.py +104 -0
- sqlspec/storage/backends/__init__.py +1 -0
- sqlspec/storage/backends/base.py +253 -0
- sqlspec/storage/backends/fsspec.py +529 -0
- sqlspec/storage/backends/local.py +441 -0
- sqlspec/storage/backends/obstore.py +916 -0
- sqlspec/storage/errors.py +104 -0
- sqlspec/storage/pipeline.py +582 -0
- sqlspec/storage/registry.py +301 -0
- sqlspec/typing.py +395 -0
- sqlspec/utils/__init__.py +7 -0
- sqlspec/utils/arrow_helpers.py +318 -0
- sqlspec/utils/config_tools.py +332 -0
- sqlspec/utils/correlation.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/correlation.py +134 -0
- sqlspec/utils/deprecation.py +190 -0
- sqlspec/utils/fixtures.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/fixtures.py +258 -0
- sqlspec/utils/logging.py +222 -0
- sqlspec/utils/module_loader.py +306 -0
- sqlspec/utils/portal.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/portal.py +375 -0
- sqlspec/utils/schema.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/schema.py +485 -0
- sqlspec/utils/serializers.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/serializers.py +408 -0
- sqlspec/utils/singleton.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/singleton.py +41 -0
- sqlspec/utils/sync_tools.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/sync_tools.py +311 -0
- sqlspec/utils/text.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/text.py +108 -0
- sqlspec/utils/type_converters.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/type_converters.py +128 -0
- sqlspec/utils/type_guards.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/type_guards.py +1360 -0
- sqlspec/utils/uuids.cpython-310-aarch64-linux-gnu.so +0 -0
- sqlspec/utils/uuids.py +225 -0
- sqlspec-0.36.0.dist-info/METADATA +205 -0
- sqlspec-0.36.0.dist-info/RECORD +531 -0
- sqlspec-0.36.0.dist-info/WHEEL +7 -0
- sqlspec-0.36.0.dist-info/entry_points.txt +2 -0
- sqlspec-0.36.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,529 @@
|
|
|
1
|
+
# pyright: reportPrivateUsage=false
|
|
2
|
+
import logging
|
|
3
|
+
from collections.abc import AsyncIterator, Iterator
|
|
4
|
+
from functools import partial
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import TYPE_CHECKING, Any, cast, overload
|
|
7
|
+
from urllib.parse import urlparse
|
|
8
|
+
|
|
9
|
+
from mypy_extensions import mypyc_attr
|
|
10
|
+
|
|
11
|
+
from sqlspec.storage._utils import import_pyarrow_parquet, resolve_storage_path
|
|
12
|
+
from sqlspec.storage.errors import execute_sync_storage_operation
|
|
13
|
+
from sqlspec.utils.logging import get_logger, log_with_context
|
|
14
|
+
from sqlspec.utils.module_loader import ensure_fsspec
|
|
15
|
+
from sqlspec.utils.sync_tools import async_
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from sqlspec.typing import ArrowRecordBatch, ArrowTable
|
|
19
|
+
|
|
20
|
+
__all__ = ("FSSpecBackend",)
|
|
21
|
+
|
|
22
|
+
logger = get_logger(__name__)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _log_storage_event(
|
|
26
|
+
event: str,
|
|
27
|
+
*,
|
|
28
|
+
backend_type: str,
|
|
29
|
+
protocol: str,
|
|
30
|
+
operation: str | None = None,
|
|
31
|
+
path: str | None = None,
|
|
32
|
+
source_path: str | None = None,
|
|
33
|
+
destination_path: str | None = None,
|
|
34
|
+
count: int | None = None,
|
|
35
|
+
exists: bool | None = None,
|
|
36
|
+
) -> None:
|
|
37
|
+
fields: dict[str, Any] = {
|
|
38
|
+
"backend_type": backend_type,
|
|
39
|
+
"protocol": protocol,
|
|
40
|
+
"path": path,
|
|
41
|
+
"source_path": source_path,
|
|
42
|
+
"destination_path": destination_path,
|
|
43
|
+
"count": count,
|
|
44
|
+
"exists": exists,
|
|
45
|
+
}
|
|
46
|
+
if operation is not None:
|
|
47
|
+
fields["operation"] = operation
|
|
48
|
+
log_with_context(logger, logging.DEBUG, event, **fields)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _write_fsspec_bytes(fs: Any, resolved_path: str, data: bytes, options: "dict[str, Any]") -> None:
|
|
52
|
+
"""Write raw bytes via an fsspec filesystem handle."""
|
|
53
|
+
with fs.open(resolved_path, mode="wb", **options) as file_obj:
|
|
54
|
+
file_obj.write(data) # pyright: ignore
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _write_fsspec_arrow(fs: Any, resolved_path: str, table: "ArrowTable", pq: Any, options: "dict[str, Any]") -> None:
|
|
58
|
+
"""Write an Arrow table via an fsspec filesystem handle."""
|
|
59
|
+
with fs.open(resolved_path, mode="wb") as file_obj:
|
|
60
|
+
pq.write_table(table, file_obj, **options) # pyright: ignore
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@mypyc_attr(allow_interpreted_subclasses=True)
|
|
64
|
+
class FSSpecBackend:
|
|
65
|
+
"""Storage backend using fsspec.
|
|
66
|
+
|
|
67
|
+
Implements ObjectStoreProtocol using fsspec for various protocols
|
|
68
|
+
including HTTP, HTTPS, FTP, and cloud storage services.
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
__slots__ = ("_fs_uri", "backend_type", "base_path", "fs", "protocol")
|
|
72
|
+
|
|
73
|
+
def __init__(self, uri: str, **kwargs: Any) -> None:
|
|
74
|
+
"""Initialize the fsspec-backed storage backend.
|
|
75
|
+
|
|
76
|
+
Args:
|
|
77
|
+
uri: Filesystem URI (protocol://path).
|
|
78
|
+
**kwargs: Additional fsspec configuration options, including an optional base_path.
|
|
79
|
+
|
|
80
|
+
For cloud URIs such as S3/GS/Azure, we derive a default base_path from the bucket/path when no explicit base_path is provided.
|
|
81
|
+
"""
|
|
82
|
+
ensure_fsspec()
|
|
83
|
+
|
|
84
|
+
base_path = kwargs.pop("base_path", "")
|
|
85
|
+
|
|
86
|
+
if "://" in uri:
|
|
87
|
+
self.protocol = uri.split("://", maxsplit=1)[0]
|
|
88
|
+
self._fs_uri = uri
|
|
89
|
+
|
|
90
|
+
if self.protocol in {"s3", "gs", "az", "gcs"}:
|
|
91
|
+
parsed = urlparse(uri)
|
|
92
|
+
if parsed.netloc:
|
|
93
|
+
uri_base_path = parsed.netloc
|
|
94
|
+
if parsed.path and parsed.path != "/":
|
|
95
|
+
uri_base_path = f"{uri_base_path}{parsed.path}"
|
|
96
|
+
if not base_path:
|
|
97
|
+
base_path = uri_base_path
|
|
98
|
+
else:
|
|
99
|
+
self.protocol = uri
|
|
100
|
+
self._fs_uri = f"{uri}://"
|
|
101
|
+
|
|
102
|
+
self.base_path = base_path.rstrip("/") if base_path else ""
|
|
103
|
+
|
|
104
|
+
import fsspec
|
|
105
|
+
|
|
106
|
+
self.fs = fsspec.filesystem(self.protocol, **kwargs)
|
|
107
|
+
self.backend_type = "fsspec"
|
|
108
|
+
|
|
109
|
+
_log_storage_event(
|
|
110
|
+
"storage.backend.ready",
|
|
111
|
+
backend_type=self.backend_type,
|
|
112
|
+
protocol=self.protocol,
|
|
113
|
+
operation="init",
|
|
114
|
+
path=self._fs_uri,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
super().__init__()
|
|
118
|
+
|
|
119
|
+
@classmethod
|
|
120
|
+
def from_config(cls, config: "dict[str, Any]") -> "FSSpecBackend":
|
|
121
|
+
protocol = config["protocol"]
|
|
122
|
+
fs_config = config.get("fs_config", {})
|
|
123
|
+
base_path = config.get("base_path", "")
|
|
124
|
+
|
|
125
|
+
uri = f"{protocol}://"
|
|
126
|
+
kwargs = dict(fs_config)
|
|
127
|
+
if base_path:
|
|
128
|
+
kwargs["base_path"] = base_path
|
|
129
|
+
|
|
130
|
+
return cls(uri=uri, **kwargs)
|
|
131
|
+
|
|
132
|
+
@property
|
|
133
|
+
def base_uri(self) -> str:
|
|
134
|
+
return self._fs_uri
|
|
135
|
+
|
|
136
|
+
def _resolve_path(self, path: str | Path) -> str:
|
|
137
|
+
return resolve_storage_path(path, self.base_path, self.protocol, strip_file_scheme=False)
|
|
138
|
+
|
|
139
|
+
def read_bytes(self, path: str | Path, **kwargs: Any) -> bytes:
|
|
140
|
+
"""Read bytes from an object."""
|
|
141
|
+
resolved_path = self._resolve_path(path)
|
|
142
|
+
result = cast(
|
|
143
|
+
"bytes",
|
|
144
|
+
execute_sync_storage_operation(
|
|
145
|
+
partial(self.fs.cat, resolved_path, **kwargs),
|
|
146
|
+
backend=self.backend_type,
|
|
147
|
+
operation="read_bytes",
|
|
148
|
+
path=resolved_path,
|
|
149
|
+
),
|
|
150
|
+
)
|
|
151
|
+
_log_storage_event(
|
|
152
|
+
"storage.read",
|
|
153
|
+
backend_type=self.backend_type,
|
|
154
|
+
protocol=self.protocol,
|
|
155
|
+
operation="read_bytes",
|
|
156
|
+
path=resolved_path,
|
|
157
|
+
)
|
|
158
|
+
return result
|
|
159
|
+
|
|
160
|
+
def write_bytes(self, path: str | Path, data: bytes, **kwargs: Any) -> None:
|
|
161
|
+
"""Write bytes to an object."""
|
|
162
|
+
resolved_path = self._resolve_path(path)
|
|
163
|
+
|
|
164
|
+
if self.protocol == "file":
|
|
165
|
+
parent_dir = str(Path(resolved_path).parent)
|
|
166
|
+
if parent_dir and not self.fs.exists(parent_dir):
|
|
167
|
+
self.fs.makedirs(parent_dir, exist_ok=True)
|
|
168
|
+
|
|
169
|
+
execute_sync_storage_operation(
|
|
170
|
+
partial(_write_fsspec_bytes, self.fs, resolved_path, data, kwargs),
|
|
171
|
+
backend=self.backend_type,
|
|
172
|
+
operation="write_bytes",
|
|
173
|
+
path=resolved_path,
|
|
174
|
+
)
|
|
175
|
+
_log_storage_event(
|
|
176
|
+
"storage.write",
|
|
177
|
+
backend_type=self.backend_type,
|
|
178
|
+
protocol=self.protocol,
|
|
179
|
+
operation="write_bytes",
|
|
180
|
+
path=resolved_path,
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
def read_text(self, path: str | Path, encoding: str = "utf-8", **kwargs: Any) -> str:
|
|
184
|
+
"""Read text from an object."""
|
|
185
|
+
data = self.read_bytes(path, **kwargs)
|
|
186
|
+
return data.decode(encoding)
|
|
187
|
+
|
|
188
|
+
def write_text(self, path: str | Path, data: str, encoding: str = "utf-8", **kwargs: Any) -> None:
|
|
189
|
+
"""Write text to an object."""
|
|
190
|
+
self.write_bytes(path, data.encode(encoding), **kwargs)
|
|
191
|
+
|
|
192
|
+
def exists(self, path: str | Path, **kwargs: Any) -> bool:
|
|
193
|
+
"""Check if an object exists."""
|
|
194
|
+
resolved_path = self._resolve_path(path)
|
|
195
|
+
exists = bool(self.fs.exists(resolved_path, **kwargs))
|
|
196
|
+
_log_storage_event(
|
|
197
|
+
"storage.read",
|
|
198
|
+
backend_type=self.backend_type,
|
|
199
|
+
protocol=self.protocol,
|
|
200
|
+
operation="exists",
|
|
201
|
+
path=resolved_path,
|
|
202
|
+
exists=bool(exists),
|
|
203
|
+
)
|
|
204
|
+
return exists
|
|
205
|
+
|
|
206
|
+
def delete(self, path: str | Path, **kwargs: Any) -> None:
|
|
207
|
+
"""Delete an object."""
|
|
208
|
+
resolved_path = self._resolve_path(path)
|
|
209
|
+
execute_sync_storage_operation(
|
|
210
|
+
partial(self.fs.rm, resolved_path, **kwargs),
|
|
211
|
+
backend=self.backend_type,
|
|
212
|
+
operation="delete",
|
|
213
|
+
path=resolved_path,
|
|
214
|
+
)
|
|
215
|
+
_log_storage_event(
|
|
216
|
+
"storage.write",
|
|
217
|
+
backend_type=self.backend_type,
|
|
218
|
+
protocol=self.protocol,
|
|
219
|
+
operation="delete",
|
|
220
|
+
path=resolved_path,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
def copy(self, source: str | Path, destination: str | Path, **kwargs: Any) -> None:
|
|
224
|
+
"""Copy an object."""
|
|
225
|
+
source_path = self._resolve_path(source)
|
|
226
|
+
dest_path = self._resolve_path(destination)
|
|
227
|
+
execute_sync_storage_operation(
|
|
228
|
+
partial(self.fs.copy, source_path, dest_path, **kwargs),
|
|
229
|
+
backend=self.backend_type,
|
|
230
|
+
operation="copy",
|
|
231
|
+
path=f"{source_path}->{dest_path}",
|
|
232
|
+
)
|
|
233
|
+
_log_storage_event(
|
|
234
|
+
"storage.write",
|
|
235
|
+
backend_type=self.backend_type,
|
|
236
|
+
protocol=self.protocol,
|
|
237
|
+
operation="copy",
|
|
238
|
+
source_path=source_path,
|
|
239
|
+
destination_path=dest_path,
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
def move(self, source: str | Path, destination: str | Path, **kwargs: Any) -> None:
|
|
243
|
+
"""Move an object."""
|
|
244
|
+
source_path = self._resolve_path(source)
|
|
245
|
+
dest_path = self._resolve_path(destination)
|
|
246
|
+
execute_sync_storage_operation(
|
|
247
|
+
partial(self.fs.mv, source_path, dest_path, **kwargs),
|
|
248
|
+
backend=self.backend_type,
|
|
249
|
+
operation="move",
|
|
250
|
+
path=f"{source_path}->{dest_path}",
|
|
251
|
+
)
|
|
252
|
+
_log_storage_event(
|
|
253
|
+
"storage.write",
|
|
254
|
+
backend_type=self.backend_type,
|
|
255
|
+
protocol=self.protocol,
|
|
256
|
+
operation="move",
|
|
257
|
+
source_path=source_path,
|
|
258
|
+
destination_path=dest_path,
|
|
259
|
+
)
|
|
260
|
+
|
|
261
|
+
def read_arrow(self, path: str | Path, **kwargs: Any) -> "ArrowTable":
|
|
262
|
+
"""Read an Arrow table from storage."""
|
|
263
|
+
pq = import_pyarrow_parquet()
|
|
264
|
+
|
|
265
|
+
resolved_path = self._resolve_path(path)
|
|
266
|
+
result = cast(
|
|
267
|
+
"ArrowTable",
|
|
268
|
+
execute_sync_storage_operation(
|
|
269
|
+
partial(self._read_parquet_table, resolved_path, pq, kwargs),
|
|
270
|
+
backend=self.backend_type,
|
|
271
|
+
operation="read_arrow",
|
|
272
|
+
path=resolved_path,
|
|
273
|
+
),
|
|
274
|
+
)
|
|
275
|
+
_log_storage_event(
|
|
276
|
+
"storage.read",
|
|
277
|
+
backend_type=self.backend_type,
|
|
278
|
+
protocol=self.protocol,
|
|
279
|
+
operation="read_arrow",
|
|
280
|
+
path=resolved_path,
|
|
281
|
+
)
|
|
282
|
+
return result
|
|
283
|
+
|
|
284
|
+
def write_arrow(self, path: str | Path, table: "ArrowTable", **kwargs: Any) -> None:
|
|
285
|
+
"""Write an Arrow table to storage."""
|
|
286
|
+
pq = import_pyarrow_parquet()
|
|
287
|
+
|
|
288
|
+
resolved_path = self._resolve_path(path)
|
|
289
|
+
|
|
290
|
+
execute_sync_storage_operation(
|
|
291
|
+
partial(_write_fsspec_arrow, self.fs, resolved_path, table, pq, kwargs),
|
|
292
|
+
backend=self.backend_type,
|
|
293
|
+
operation="write_arrow",
|
|
294
|
+
path=resolved_path,
|
|
295
|
+
)
|
|
296
|
+
_log_storage_event(
|
|
297
|
+
"storage.write",
|
|
298
|
+
backend_type=self.backend_type,
|
|
299
|
+
protocol=self.protocol,
|
|
300
|
+
operation="write_arrow",
|
|
301
|
+
path=resolved_path,
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
def _read_parquet_table(self, resolved_path: str, pq: Any, options: "dict[str, Any]") -> Any:
|
|
305
|
+
with self.fs.open(resolved_path, mode="rb", **options) as file_obj:
|
|
306
|
+
return pq.read_table(file_obj)
|
|
307
|
+
|
|
308
|
+
def list_objects(self, prefix: str = "", recursive: bool = True, **kwargs: Any) -> "list[str]":
|
|
309
|
+
"""List objects with optional prefix."""
|
|
310
|
+
resolved_prefix = resolve_storage_path(prefix, self.base_path, self.protocol, strip_file_scheme=False)
|
|
311
|
+
if recursive:
|
|
312
|
+
results = sorted(self.fs.find(resolved_prefix, **kwargs))
|
|
313
|
+
else:
|
|
314
|
+
results = sorted(self.fs.ls(resolved_prefix, detail=False, **kwargs))
|
|
315
|
+
_log_storage_event(
|
|
316
|
+
"storage.list",
|
|
317
|
+
backend_type=self.backend_type,
|
|
318
|
+
protocol=self.protocol,
|
|
319
|
+
operation="list_objects",
|
|
320
|
+
path=resolved_prefix,
|
|
321
|
+
count=len(results),
|
|
322
|
+
)
|
|
323
|
+
return results
|
|
324
|
+
|
|
325
|
+
def glob(self, pattern: str, **kwargs: Any) -> "list[str]":
|
|
326
|
+
"""Find objects matching a glob pattern."""
|
|
327
|
+
resolved_pattern = resolve_storage_path(pattern, self.base_path, self.protocol, strip_file_scheme=False)
|
|
328
|
+
results = sorted(self.fs.glob(resolved_pattern, **kwargs)) # pyright: ignore
|
|
329
|
+
_log_storage_event(
|
|
330
|
+
"storage.list",
|
|
331
|
+
backend_type=self.backend_type,
|
|
332
|
+
protocol=self.protocol,
|
|
333
|
+
operation="glob",
|
|
334
|
+
path=resolved_pattern,
|
|
335
|
+
count=len(results),
|
|
336
|
+
)
|
|
337
|
+
return results
|
|
338
|
+
|
|
339
|
+
def is_object(self, path: str | Path) -> bool:
|
|
340
|
+
"""Check if path points to an object."""
|
|
341
|
+
resolved_path = resolve_storage_path(path, self.base_path, self.protocol, strip_file_scheme=False)
|
|
342
|
+
return self.fs.exists(resolved_path) and not self.fs.isdir(resolved_path)
|
|
343
|
+
|
|
344
|
+
def is_path(self, path: str | Path) -> bool:
|
|
345
|
+
"""Check if path points to a prefix (directory-like)."""
|
|
346
|
+
resolved_path = resolve_storage_path(path, self.base_path, self.protocol, strip_file_scheme=False)
|
|
347
|
+
return self.fs.isdir(resolved_path) # type: ignore[no-any-return]
|
|
348
|
+
|
|
349
|
+
def get_metadata(self, path: str | Path, **kwargs: Any) -> "dict[str, object]":
|
|
350
|
+
"""Get object metadata."""
|
|
351
|
+
resolved_path = resolve_storage_path(path, self.base_path, self.protocol, strip_file_scheme=False)
|
|
352
|
+
try:
|
|
353
|
+
info = self.fs.info(resolved_path, **kwargs)
|
|
354
|
+
except FileNotFoundError:
|
|
355
|
+
return {"path": resolved_path, "exists": False}
|
|
356
|
+
else:
|
|
357
|
+
if isinstance(info, dict):
|
|
358
|
+
return {
|
|
359
|
+
"path": resolved_path,
|
|
360
|
+
"exists": True,
|
|
361
|
+
"size": info.get("size"),
|
|
362
|
+
"last_modified": info.get("mtime"),
|
|
363
|
+
"type": info.get("type", "file"),
|
|
364
|
+
}
|
|
365
|
+
return {
|
|
366
|
+
"path": resolved_path,
|
|
367
|
+
"exists": True,
|
|
368
|
+
"size": info.size,
|
|
369
|
+
"last_modified": info.mtime,
|
|
370
|
+
"type": info.type,
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
@property
|
|
374
|
+
def supports_signing(self) -> bool:
|
|
375
|
+
"""Whether this backend supports URL signing.
|
|
376
|
+
|
|
377
|
+
FSSpec backends do not support URL signing. Use ObStoreBackend
|
|
378
|
+
for S3, GCS, or Azure if you need signed URLs.
|
|
379
|
+
|
|
380
|
+
Returns:
|
|
381
|
+
Always False for fsspec backends.
|
|
382
|
+
"""
|
|
383
|
+
return False
|
|
384
|
+
|
|
385
|
+
@overload
|
|
386
|
+
def sign_sync(self, paths: str, expires_in: int = 3600, for_upload: bool = False) -> str: ...
|
|
387
|
+
|
|
388
|
+
@overload
|
|
389
|
+
def sign_sync(self, paths: "list[str]", expires_in: int = 3600, for_upload: bool = False) -> "list[str]": ...
|
|
390
|
+
|
|
391
|
+
def sign_sync(
|
|
392
|
+
self, paths: "str | list[str]", expires_in: int = 3600, for_upload: bool = False
|
|
393
|
+
) -> "str | list[str]":
|
|
394
|
+
"""Generate signed URL(s).
|
|
395
|
+
|
|
396
|
+
Raises:
|
|
397
|
+
NotImplementedError: fsspec backends do not support URL signing.
|
|
398
|
+
Use obstore backend for S3, GCS, or Azure if you need signed URLs.
|
|
399
|
+
"""
|
|
400
|
+
msg = (
|
|
401
|
+
f"URL signing is not supported for fsspec backend (protocol: {self.protocol}). "
|
|
402
|
+
"For S3, GCS, or Azure signed URLs, use ObStoreBackend instead."
|
|
403
|
+
)
|
|
404
|
+
raise NotImplementedError(msg)
|
|
405
|
+
|
|
406
|
+
def stream_read(self, path: "str | Path", chunk_size: "int | None" = None, **kwargs: Any) -> Iterator[bytes]:
|
|
407
|
+
"""Stream bytes from storage."""
|
|
408
|
+
resolved_path = self._resolve_path(path)
|
|
409
|
+
chunk_size = chunk_size or 65536
|
|
410
|
+
|
|
411
|
+
with self.fs.open(resolved_path, mode="rb", **kwargs) as f:
|
|
412
|
+
while True:
|
|
413
|
+
chunk = f.read(chunk_size)
|
|
414
|
+
if not chunk:
|
|
415
|
+
break
|
|
416
|
+
yield chunk
|
|
417
|
+
|
|
418
|
+
def stream_arrow(self, pattern: str, **kwargs: Any) -> Iterator["ArrowRecordBatch"]:
|
|
419
|
+
"""Stream Arrow record batches from storage.
|
|
420
|
+
|
|
421
|
+
Args:
|
|
422
|
+
pattern: The glob pattern to match.
|
|
423
|
+
**kwargs: Additional arguments to pass to the glob method.
|
|
424
|
+
|
|
425
|
+
Yields:
|
|
426
|
+
Arrow record batches from matching files.
|
|
427
|
+
"""
|
|
428
|
+
pq = import_pyarrow_parquet()
|
|
429
|
+
for obj_path in self.glob(pattern, **kwargs):
|
|
430
|
+
file_handle = execute_sync_storage_operation(
|
|
431
|
+
partial(self.fs.open, obj_path, mode="rb"),
|
|
432
|
+
backend=self.backend_type,
|
|
433
|
+
operation="stream_open",
|
|
434
|
+
path=str(obj_path),
|
|
435
|
+
)
|
|
436
|
+
with file_handle as stream:
|
|
437
|
+
parquet_file = execute_sync_storage_operation(
|
|
438
|
+
partial(pq.ParquetFile, stream),
|
|
439
|
+
backend=self.backend_type,
|
|
440
|
+
operation="stream_arrow",
|
|
441
|
+
path=str(obj_path),
|
|
442
|
+
)
|
|
443
|
+
yield from parquet_file.iter_batches() # pyright: ignore[reportUnknownMemberType]
|
|
444
|
+
|
|
445
|
+
async def read_bytes_async(self, path: "str | Path", **kwargs: Any) -> bytes:
|
|
446
|
+
"""Read bytes from storage asynchronously."""
|
|
447
|
+
return await async_(self.read_bytes)(path, **kwargs)
|
|
448
|
+
|
|
449
|
+
async def write_bytes_async(self, path: "str | Path", data: bytes, **kwargs: Any) -> None:
|
|
450
|
+
"""Write bytes to storage asynchronously."""
|
|
451
|
+
return await async_(self.write_bytes)(path, data, **kwargs)
|
|
452
|
+
|
|
453
|
+
async def stream_read_async(
|
|
454
|
+
self, path: "str | Path", chunk_size: "int | None" = None, **kwargs: Any
|
|
455
|
+
) -> AsyncIterator[bytes]:
|
|
456
|
+
"""Stream bytes from storage asynchronously."""
|
|
457
|
+
from sqlspec.storage.backends.base import AsyncBytesIterator
|
|
458
|
+
|
|
459
|
+
return AsyncBytesIterator(self.stream_read(path, chunk_size, **kwargs))
|
|
460
|
+
|
|
461
|
+
def stream_arrow_async(self, pattern: str, **kwargs: Any) -> AsyncIterator["ArrowRecordBatch"]:
|
|
462
|
+
"""Stream Arrow record batches from storage asynchronously.
|
|
463
|
+
|
|
464
|
+
Args:
|
|
465
|
+
pattern: The glob pattern to match.
|
|
466
|
+
**kwargs: Additional arguments to pass to the glob method.
|
|
467
|
+
|
|
468
|
+
Returns:
|
|
469
|
+
AsyncIterator yielding Arrow record batches.
|
|
470
|
+
"""
|
|
471
|
+
from sqlspec.storage.backends.base import AsyncArrowBatchIterator
|
|
472
|
+
|
|
473
|
+
return AsyncArrowBatchIterator(self.stream_arrow(pattern, **kwargs))
|
|
474
|
+
|
|
475
|
+
async def read_text_async(self, path: "str | Path", encoding: str = "utf-8", **kwargs: Any) -> str:
|
|
476
|
+
"""Read text from storage asynchronously."""
|
|
477
|
+
return await async_(self.read_text)(path, encoding, **kwargs)
|
|
478
|
+
|
|
479
|
+
async def write_text_async(self, path: str | Path, data: str, encoding: str = "utf-8", **kwargs: Any) -> None:
|
|
480
|
+
"""Write text to storage asynchronously."""
|
|
481
|
+
await async_(self.write_text)(path, data, encoding, **kwargs)
|
|
482
|
+
|
|
483
|
+
async def list_objects_async(self, prefix: str = "", recursive: bool = True, **kwargs: Any) -> "list[str]":
|
|
484
|
+
"""List objects in storage asynchronously."""
|
|
485
|
+
return await async_(self.list_objects)(prefix, recursive, **kwargs)
|
|
486
|
+
|
|
487
|
+
async def exists_async(self, path: str | Path, **kwargs: Any) -> bool:
|
|
488
|
+
"""Check if object exists in storage asynchronously."""
|
|
489
|
+
return await async_(self.exists)(path, **kwargs)
|
|
490
|
+
|
|
491
|
+
async def delete_async(self, path: str | Path, **kwargs: Any) -> None:
|
|
492
|
+
"""Delete object from storage asynchronously."""
|
|
493
|
+
await async_(self.delete)(path, **kwargs)
|
|
494
|
+
|
|
495
|
+
async def copy_async(self, source: str | Path, destination: str | Path, **kwargs: Any) -> None:
|
|
496
|
+
"""Copy object in storage asynchronously."""
|
|
497
|
+
await async_(self.copy)(source, destination, **kwargs)
|
|
498
|
+
|
|
499
|
+
async def move_async(self, source: str | Path, destination: str | Path, **kwargs: Any) -> None:
|
|
500
|
+
"""Move object in storage asynchronously."""
|
|
501
|
+
await async_(self.move)(source, destination, **kwargs)
|
|
502
|
+
|
|
503
|
+
async def get_metadata_async(self, path: str | Path, **kwargs: Any) -> "dict[str, object]":
|
|
504
|
+
"""Get object metadata from storage asynchronously."""
|
|
505
|
+
return await async_(self.get_metadata)(path, **kwargs)
|
|
506
|
+
|
|
507
|
+
@overload
|
|
508
|
+
async def sign_async(self, paths: str, expires_in: int = 3600, for_upload: bool = False) -> str: ...
|
|
509
|
+
|
|
510
|
+
@overload
|
|
511
|
+
async def sign_async(self, paths: "list[str]", expires_in: int = 3600, for_upload: bool = False) -> "list[str]": ...
|
|
512
|
+
|
|
513
|
+
async def sign_async(
|
|
514
|
+
self, paths: "str | list[str]", expires_in: int = 3600, for_upload: bool = False
|
|
515
|
+
) -> "str | list[str]":
|
|
516
|
+
"""Generate signed URL(s) asynchronously.
|
|
517
|
+
|
|
518
|
+
Raises:
|
|
519
|
+
NotImplementedError: fsspec backends do not support URL signing.
|
|
520
|
+
"""
|
|
521
|
+
return await async_(self.sign_sync)(paths, expires_in, for_upload) # type: ignore[arg-type]
|
|
522
|
+
|
|
523
|
+
async def read_arrow_async(self, path: str | Path, **kwargs: Any) -> "ArrowTable":
|
|
524
|
+
"""Read Arrow table from storage asynchronously."""
|
|
525
|
+
return self.read_arrow(path, **kwargs)
|
|
526
|
+
|
|
527
|
+
async def write_arrow_async(self, path: str | Path, table: "ArrowTable", **kwargs: Any) -> None:
|
|
528
|
+
"""Write Arrow table to storage asynchronously."""
|
|
529
|
+
self.write_arrow(path, table, **kwargs)
|