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,441 @@
|
|
|
1
|
+
"""Local file system storage backend.
|
|
2
|
+
|
|
3
|
+
A simple, zero-dependency implementation for local file operations.
|
|
4
|
+
No external dependencies like fsspec or obstore required.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import asyncio
|
|
8
|
+
import shutil
|
|
9
|
+
from collections.abc import AsyncIterator, Iterator
|
|
10
|
+
from functools import partial
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import TYPE_CHECKING, Any, cast, overload
|
|
13
|
+
from urllib.parse import unquote, urlparse
|
|
14
|
+
|
|
15
|
+
from mypy_extensions import mypyc_attr
|
|
16
|
+
|
|
17
|
+
from sqlspec.exceptions import FileNotFoundInStorageError
|
|
18
|
+
from sqlspec.storage._utils import import_pyarrow_parquet
|
|
19
|
+
from sqlspec.storage.errors import execute_sync_storage_operation
|
|
20
|
+
from sqlspec.utils.sync_tools import async_
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
import asyncio
|
|
24
|
+
|
|
25
|
+
from sqlspec.typing import ArrowRecordBatch, ArrowTable
|
|
26
|
+
|
|
27
|
+
__all__ = ("LocalStore",)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _write_local_bytes(resolved: "Path", data: bytes) -> None:
|
|
31
|
+
"""Write bytes to a local file, ensuring parent directories exist."""
|
|
32
|
+
resolved.parent.mkdir(parents=True, exist_ok=True)
|
|
33
|
+
resolved.write_bytes(data)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _delete_local_path(resolved: "Path") -> None:
|
|
37
|
+
"""Delete a local file or directory."""
|
|
38
|
+
if resolved.is_dir():
|
|
39
|
+
shutil.rmtree(resolved)
|
|
40
|
+
elif resolved.exists():
|
|
41
|
+
resolved.unlink()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _copy_local_path(src: "Path", dst: "Path") -> None:
|
|
45
|
+
"""Copy a local file or directory."""
|
|
46
|
+
if src.is_dir():
|
|
47
|
+
shutil.copytree(src, dst, dirs_exist_ok=True)
|
|
48
|
+
else:
|
|
49
|
+
shutil.copy2(src, dst)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _write_local_arrow(resolved: "Path", table: "ArrowTable", pq: Any, options: "dict[str, Any]") -> None:
|
|
53
|
+
"""Write an Arrow table to a local path."""
|
|
54
|
+
resolved.parent.mkdir(parents=True, exist_ok=True)
|
|
55
|
+
pq.write_table(table, str(resolved), **options) # pyright: ignore
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@mypyc_attr(allow_interpreted_subclasses=True)
|
|
59
|
+
class LocalStore:
|
|
60
|
+
"""Simple local file system storage backend.
|
|
61
|
+
|
|
62
|
+
Provides file system operations without requiring fsspec or obstore.
|
|
63
|
+
Supports file:// URIs and regular file paths.
|
|
64
|
+
|
|
65
|
+
Implements ObjectStoreProtocol for type safety.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
__slots__ = ("_loop", "backend_type", "base_path", "protocol")
|
|
69
|
+
|
|
70
|
+
def __init__(self, uri: str = "", **kwargs: Any) -> None:
|
|
71
|
+
"""Initialize local storage backend.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
uri: File URI or path (e.g., "file:///path" or "/path")
|
|
75
|
+
**kwargs: Additional options (base_path for relative operations)
|
|
76
|
+
|
|
77
|
+
The URI may be a file:// path (Windows style like file:///C:/path is supported),
|
|
78
|
+
and an explicit base_path override will take precedence before we ensure the directory exists.
|
|
79
|
+
"""
|
|
80
|
+
if uri.startswith("file://"):
|
|
81
|
+
parsed = urlparse(uri)
|
|
82
|
+
path = unquote(parsed.path)
|
|
83
|
+
if path and len(path) > 2 and path[2] == ":": # noqa: PLR2004
|
|
84
|
+
path = path[1:]
|
|
85
|
+
self.base_path = Path(path).resolve()
|
|
86
|
+
elif uri:
|
|
87
|
+
self.base_path = Path(uri).resolve()
|
|
88
|
+
else:
|
|
89
|
+
self.base_path = Path.cwd()
|
|
90
|
+
|
|
91
|
+
if "base_path" in kwargs:
|
|
92
|
+
self.base_path = Path(kwargs["base_path"]).resolve()
|
|
93
|
+
|
|
94
|
+
if not self.base_path.exists():
|
|
95
|
+
self.base_path.mkdir(parents=True, exist_ok=True)
|
|
96
|
+
elif self.base_path.is_file():
|
|
97
|
+
self.base_path = self.base_path.parent
|
|
98
|
+
self._loop: asyncio.AbstractEventLoop | None = None
|
|
99
|
+
|
|
100
|
+
self.protocol = "file"
|
|
101
|
+
self.backend_type = "local"
|
|
102
|
+
|
|
103
|
+
def _resolve_path(self, path: "str | Path") -> Path:
|
|
104
|
+
"""Resolve path relative to base_path.
|
|
105
|
+
|
|
106
|
+
Args:
|
|
107
|
+
path: Path to resolve (absolute or relative).
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
Resolved Path object.
|
|
111
|
+
"""
|
|
112
|
+
p = Path(path)
|
|
113
|
+
return p if p.is_absolute() else self.base_path / p
|
|
114
|
+
|
|
115
|
+
def read_bytes(self, path: "str | Path", **kwargs: Any) -> bytes:
|
|
116
|
+
"""Read bytes from file."""
|
|
117
|
+
resolved = self._resolve_path(path)
|
|
118
|
+
try:
|
|
119
|
+
return execute_sync_storage_operation(
|
|
120
|
+
resolved.read_bytes, backend=self.backend_type, operation="read_bytes", path=str(resolved)
|
|
121
|
+
)
|
|
122
|
+
except FileNotFoundInStorageError as error:
|
|
123
|
+
raise FileNotFoundError(str(resolved)) from error
|
|
124
|
+
|
|
125
|
+
def write_bytes(self, path: "str | Path", data: bytes, **kwargs: Any) -> None:
|
|
126
|
+
"""Write bytes to file."""
|
|
127
|
+
resolved = self._resolve_path(path)
|
|
128
|
+
|
|
129
|
+
execute_sync_storage_operation(
|
|
130
|
+
partial(_write_local_bytes, resolved, data),
|
|
131
|
+
backend=self.backend_type,
|
|
132
|
+
operation="write_bytes",
|
|
133
|
+
path=str(resolved),
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
def read_text(self, path: "str | Path", encoding: str = "utf-8", **kwargs: Any) -> str:
|
|
137
|
+
"""Read text from file."""
|
|
138
|
+
data = self.read_bytes(path, **kwargs)
|
|
139
|
+
return data.decode(encoding)
|
|
140
|
+
|
|
141
|
+
def write_text(self, path: "str | Path", data: str, encoding: str = "utf-8", **kwargs: Any) -> None:
|
|
142
|
+
"""Write text to file."""
|
|
143
|
+
encoded = data.encode(encoding)
|
|
144
|
+
self.write_bytes(path, encoded, **kwargs)
|
|
145
|
+
|
|
146
|
+
def stream_read(self, path: "str | Path", chunk_size: "int | None" = None, **kwargs: Any) -> Iterator[bytes]:
|
|
147
|
+
"""Stream bytes from file."""
|
|
148
|
+
resolved = self._resolve_path(path)
|
|
149
|
+
chunk_size = chunk_size or 65536
|
|
150
|
+
try:
|
|
151
|
+
with resolved.open("rb") as f:
|
|
152
|
+
while True:
|
|
153
|
+
chunk = f.read(chunk_size)
|
|
154
|
+
if not chunk:
|
|
155
|
+
break
|
|
156
|
+
yield chunk
|
|
157
|
+
except FileNotFoundError as error:
|
|
158
|
+
raise FileNotFoundError(str(resolved)) from error
|
|
159
|
+
|
|
160
|
+
def list_objects(self, prefix: str = "", recursive: bool = True, **kwargs: Any) -> "list[str]":
|
|
161
|
+
"""List objects in directory.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
prefix: Optional prefix that may look like a directory or filename filter.
|
|
165
|
+
recursive: Whether to walk subdirectories.
|
|
166
|
+
**kwargs: Additional backend-specific options (currently unused).
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
prefix: Optional prefix that may look like a directory or filename filter.
|
|
170
|
+
recursive: Whether to walk subdirectories.
|
|
171
|
+
|
|
172
|
+
When the prefix resembles a directory (contains a slash or ends with '/'), we treat it as a path; otherwise we filter filenames within the base path.
|
|
173
|
+
Paths outside base_path are returned with their absolute names.
|
|
174
|
+
"""
|
|
175
|
+
if prefix and (prefix.endswith("/") or "/" in prefix):
|
|
176
|
+
search_path = self._resolve_path(prefix)
|
|
177
|
+
if not search_path.exists():
|
|
178
|
+
return []
|
|
179
|
+
if search_path.is_file():
|
|
180
|
+
return [str(search_path.relative_to(self.base_path))]
|
|
181
|
+
else:
|
|
182
|
+
search_path = self.base_path
|
|
183
|
+
|
|
184
|
+
pattern = "**/*" if recursive else "*"
|
|
185
|
+
files = []
|
|
186
|
+
for path in search_path.glob(pattern):
|
|
187
|
+
if path.is_file():
|
|
188
|
+
try:
|
|
189
|
+
relative = path.relative_to(self.base_path)
|
|
190
|
+
relative_str = str(relative)
|
|
191
|
+
if not prefix or relative_str.startswith(prefix):
|
|
192
|
+
files.append(relative_str)
|
|
193
|
+
except ValueError:
|
|
194
|
+
path_str = str(path)
|
|
195
|
+
if not prefix or path_str.startswith(prefix):
|
|
196
|
+
files.append(path_str)
|
|
197
|
+
|
|
198
|
+
return sorted(files)
|
|
199
|
+
|
|
200
|
+
def exists(self, path: "str | Path", **kwargs: Any) -> bool:
|
|
201
|
+
"""Check if file exists."""
|
|
202
|
+
return self._resolve_path(path).exists()
|
|
203
|
+
|
|
204
|
+
def delete(self, path: "str | Path", **kwargs: Any) -> None:
|
|
205
|
+
"""Delete file or directory."""
|
|
206
|
+
resolved = self._resolve_path(path)
|
|
207
|
+
|
|
208
|
+
execute_sync_storage_operation(
|
|
209
|
+
partial(_delete_local_path, resolved), backend=self.backend_type, operation="delete", path=str(resolved)
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
def copy(self, source: "str | Path", destination: "str | Path", **kwargs: Any) -> None:
|
|
213
|
+
"""Copy file or directory."""
|
|
214
|
+
src = self._resolve_path(source)
|
|
215
|
+
dst = self._resolve_path(destination)
|
|
216
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
217
|
+
|
|
218
|
+
execute_sync_storage_operation(
|
|
219
|
+
partial(_copy_local_path, src, dst), backend=self.backend_type, operation="copy", path=f"{src}->{dst}"
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
def move(self, source: "str | Path", destination: "str | Path", **kwargs: Any) -> None:
|
|
223
|
+
"""Move file or directory."""
|
|
224
|
+
src = self._resolve_path(source)
|
|
225
|
+
dst = self._resolve_path(destination)
|
|
226
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
227
|
+
execute_sync_storage_operation(
|
|
228
|
+
partial(shutil.move, str(src), str(dst)), backend=self.backend_type, operation="move", path=f"{src}->{dst}"
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
def glob(self, pattern: str, **kwargs: Any) -> "list[str]":
|
|
232
|
+
"""Find files matching pattern.
|
|
233
|
+
|
|
234
|
+
Supports both relative and absolute patterns by adjusting where the glob search begins.
|
|
235
|
+
"""
|
|
236
|
+
if Path(pattern).is_absolute():
|
|
237
|
+
base_path = Path(pattern).parent
|
|
238
|
+
pattern_name = Path(pattern).name
|
|
239
|
+
matches = base_path.rglob(pattern_name) if "**" in pattern else base_path.glob(pattern_name)
|
|
240
|
+
else:
|
|
241
|
+
matches = self.base_path.rglob(pattern) if "**" in pattern else self.base_path.glob(pattern)
|
|
242
|
+
|
|
243
|
+
results = []
|
|
244
|
+
for match in matches:
|
|
245
|
+
if match.is_file():
|
|
246
|
+
try:
|
|
247
|
+
relative = match.relative_to(self.base_path)
|
|
248
|
+
results.append(str(relative))
|
|
249
|
+
except ValueError:
|
|
250
|
+
results.append(str(match))
|
|
251
|
+
|
|
252
|
+
return sorted(results)
|
|
253
|
+
|
|
254
|
+
def get_metadata(self, path: "str | Path", **kwargs: Any) -> "dict[str, object]":
|
|
255
|
+
"""Get file metadata."""
|
|
256
|
+
resolved = self._resolve_path(path)
|
|
257
|
+
return execute_sync_storage_operation(
|
|
258
|
+
partial(self._collect_metadata, resolved),
|
|
259
|
+
backend=self.backend_type,
|
|
260
|
+
operation="get_metadata",
|
|
261
|
+
path=str(resolved),
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
def _collect_metadata(self, resolved: "Path") -> "dict[str, object]":
|
|
265
|
+
if not resolved.exists():
|
|
266
|
+
return {}
|
|
267
|
+
|
|
268
|
+
stat = resolved.stat()
|
|
269
|
+
return {
|
|
270
|
+
"size": stat.st_size,
|
|
271
|
+
"modified": stat.st_mtime,
|
|
272
|
+
"created": stat.st_ctime,
|
|
273
|
+
"is_file": resolved.is_file(),
|
|
274
|
+
"is_dir": resolved.is_dir(),
|
|
275
|
+
"path": str(resolved),
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
def is_object(self, path: "str | Path") -> bool:
|
|
279
|
+
"""Check if path points to a file."""
|
|
280
|
+
return self._resolve_path(path).is_file()
|
|
281
|
+
|
|
282
|
+
def is_path(self, path: "str | Path") -> bool:
|
|
283
|
+
"""Check if path points to a directory."""
|
|
284
|
+
return self._resolve_path(path).is_dir()
|
|
285
|
+
|
|
286
|
+
def read_arrow(self, path: "str | Path", **kwargs: Any) -> "ArrowTable":
|
|
287
|
+
"""Read Arrow table from file."""
|
|
288
|
+
pq = import_pyarrow_parquet()
|
|
289
|
+
resolved = self._resolve_path(path)
|
|
290
|
+
return cast(
|
|
291
|
+
"ArrowTable",
|
|
292
|
+
execute_sync_storage_operation(
|
|
293
|
+
partial(pq.read_table, str(resolved), **kwargs),
|
|
294
|
+
backend=self.backend_type,
|
|
295
|
+
operation="read_arrow",
|
|
296
|
+
path=str(resolved),
|
|
297
|
+
),
|
|
298
|
+
)
|
|
299
|
+
|
|
300
|
+
def write_arrow(self, path: "str | Path", table: "ArrowTable", **kwargs: Any) -> None:
|
|
301
|
+
"""Write Arrow table to file."""
|
|
302
|
+
pq = import_pyarrow_parquet()
|
|
303
|
+
resolved = self._resolve_path(path)
|
|
304
|
+
|
|
305
|
+
execute_sync_storage_operation(
|
|
306
|
+
partial(_write_local_arrow, resolved, table, pq, kwargs),
|
|
307
|
+
backend=self.backend_type,
|
|
308
|
+
operation="write_arrow",
|
|
309
|
+
path=str(resolved),
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
def stream_arrow(self, pattern: str, **kwargs: Any) -> Iterator["ArrowRecordBatch"]:
|
|
313
|
+
"""Stream Arrow record batches from files matching pattern.
|
|
314
|
+
|
|
315
|
+
Yields:
|
|
316
|
+
Arrow record batches from matching files.
|
|
317
|
+
"""
|
|
318
|
+
pq = import_pyarrow_parquet()
|
|
319
|
+
files = self.glob(pattern)
|
|
320
|
+
for file_path in files:
|
|
321
|
+
resolved = self._resolve_path(file_path)
|
|
322
|
+
resolved_str = str(resolved)
|
|
323
|
+
parquet_file = execute_sync_storage_operation(
|
|
324
|
+
partial(pq.ParquetFile, resolved_str),
|
|
325
|
+
backend=self.backend_type,
|
|
326
|
+
operation="stream_arrow",
|
|
327
|
+
path=resolved_str,
|
|
328
|
+
)
|
|
329
|
+
yield from parquet_file.iter_batches() # pyright: ignore[reportUnknownMemberType]
|
|
330
|
+
|
|
331
|
+
@property
|
|
332
|
+
def supports_signing(self) -> bool:
|
|
333
|
+
"""Whether this backend supports URL signing.
|
|
334
|
+
|
|
335
|
+
Local file storage does not support URL signing.
|
|
336
|
+
Local files are accessed directly via file:// URIs.
|
|
337
|
+
|
|
338
|
+
Returns:
|
|
339
|
+
Always False for local storage.
|
|
340
|
+
"""
|
|
341
|
+
return False
|
|
342
|
+
|
|
343
|
+
@overload
|
|
344
|
+
def sign_sync(self, paths: str, expires_in: int = 3600, for_upload: bool = False) -> str: ...
|
|
345
|
+
|
|
346
|
+
@overload
|
|
347
|
+
def sign_sync(self, paths: "list[str]", expires_in: int = 3600, for_upload: bool = False) -> "list[str]": ...
|
|
348
|
+
|
|
349
|
+
def sign_sync(
|
|
350
|
+
self, paths: "str | list[str]", expires_in: int = 3600, for_upload: bool = False
|
|
351
|
+
) -> "str | list[str]":
|
|
352
|
+
"""Generate signed URL(s).
|
|
353
|
+
|
|
354
|
+
Raises:
|
|
355
|
+
NotImplementedError: Local file storage does not require URL signing.
|
|
356
|
+
Local files are accessed directly via file:// URIs.
|
|
357
|
+
"""
|
|
358
|
+
msg = "URL signing is not applicable to local file storage. Use file:// URIs directly."
|
|
359
|
+
raise NotImplementedError(msg)
|
|
360
|
+
|
|
361
|
+
async def read_bytes_async(self, path: "str | Path", **kwargs: Any) -> bytes:
|
|
362
|
+
"""Read bytes from file asynchronously."""
|
|
363
|
+
return await async_(self.read_bytes)(path, **kwargs)
|
|
364
|
+
|
|
365
|
+
async def write_bytes_async(self, path: "str | Path", data: bytes, **kwargs: Any) -> None:
|
|
366
|
+
"""Write bytes to file asynchronously."""
|
|
367
|
+
await async_(self.write_bytes)(path, data, **kwargs)
|
|
368
|
+
|
|
369
|
+
async def read_text_async(self, path: "str | Path", encoding: str = "utf-8", **kwargs: Any) -> str:
|
|
370
|
+
"""Read text from file asynchronously."""
|
|
371
|
+
return await async_(self.read_text)(path, encoding, **kwargs)
|
|
372
|
+
|
|
373
|
+
async def write_text_async(self, path: "str | Path", data: str, encoding: str = "utf-8", **kwargs: Any) -> None:
|
|
374
|
+
"""Write text to file asynchronously."""
|
|
375
|
+
await async_(self.write_text)(path, data, encoding, **kwargs)
|
|
376
|
+
|
|
377
|
+
async def stream_read_async(
|
|
378
|
+
self, path: "str | Path", chunk_size: "int | None" = None, **kwargs: Any
|
|
379
|
+
) -> AsyncIterator[bytes]:
|
|
380
|
+
"""Stream bytes from file asynchronously."""
|
|
381
|
+
from sqlspec.storage.backends.base import AsyncBytesIterator
|
|
382
|
+
|
|
383
|
+
return AsyncBytesIterator(self.stream_read(path, chunk_size, **kwargs))
|
|
384
|
+
|
|
385
|
+
async def list_objects_async(self, prefix: str = "", recursive: bool = True, **kwargs: Any) -> "list[str]":
|
|
386
|
+
"""List objects asynchronously."""
|
|
387
|
+
return await async_(self.list_objects)(prefix, recursive, **kwargs)
|
|
388
|
+
|
|
389
|
+
async def exists_async(self, path: "str | Path", **kwargs: Any) -> bool:
|
|
390
|
+
"""Check if file exists asynchronously."""
|
|
391
|
+
return await async_(self.exists)(path, **kwargs)
|
|
392
|
+
|
|
393
|
+
async def delete_async(self, path: "str | Path", **kwargs: Any) -> None:
|
|
394
|
+
"""Delete file asynchronously."""
|
|
395
|
+
await async_(self.delete)(path, **kwargs)
|
|
396
|
+
|
|
397
|
+
async def copy_async(self, source: "str | Path", destination: "str | Path", **kwargs: Any) -> None:
|
|
398
|
+
"""Copy file asynchronously."""
|
|
399
|
+
await async_(self.copy)(source, destination, **kwargs)
|
|
400
|
+
|
|
401
|
+
async def move_async(self, source: "str | Path", destination: "str | Path", **kwargs: Any) -> None:
|
|
402
|
+
"""Move file asynchronously."""
|
|
403
|
+
await async_(self.move)(source, destination, **kwargs)
|
|
404
|
+
|
|
405
|
+
async def get_metadata_async(self, path: "str | Path", **kwargs: Any) -> "dict[str, object]":
|
|
406
|
+
"""Get file metadata asynchronously."""
|
|
407
|
+
return await async_(self.get_metadata)(path, **kwargs)
|
|
408
|
+
|
|
409
|
+
async def read_arrow_async(self, path: "str | Path", **kwargs: Any) -> "ArrowTable":
|
|
410
|
+
"""Read Arrow table asynchronously."""
|
|
411
|
+
return self.read_arrow(path, **kwargs)
|
|
412
|
+
|
|
413
|
+
async def write_arrow_async(self, path: "str | Path", table: "ArrowTable", **kwargs: Any) -> None:
|
|
414
|
+
"""Write Arrow table asynchronously."""
|
|
415
|
+
self.write_arrow(path, table, **kwargs)
|
|
416
|
+
|
|
417
|
+
def stream_arrow_async(self, pattern: str, **kwargs: Any) -> AsyncIterator["ArrowRecordBatch"]:
|
|
418
|
+
"""Stream Arrow record batches asynchronously.
|
|
419
|
+
|
|
420
|
+
Args:
|
|
421
|
+
pattern: Glob pattern to match files.
|
|
422
|
+
**kwargs: Additional arguments passed to stream_arrow().
|
|
423
|
+
|
|
424
|
+
Returns:
|
|
425
|
+
AsyncIterator yielding Arrow record batches.
|
|
426
|
+
"""
|
|
427
|
+
from sqlspec.storage.backends.base import AsyncArrowBatchIterator
|
|
428
|
+
|
|
429
|
+
return AsyncArrowBatchIterator(self.stream_arrow(pattern, **kwargs))
|
|
430
|
+
|
|
431
|
+
@overload
|
|
432
|
+
async def sign_async(self, paths: str, expires_in: int = 3600, for_upload: bool = False) -> str: ...
|
|
433
|
+
|
|
434
|
+
@overload
|
|
435
|
+
async def sign_async(self, paths: "list[str]", expires_in: int = 3600, for_upload: bool = False) -> "list[str]": ...
|
|
436
|
+
|
|
437
|
+
async def sign_async(
|
|
438
|
+
self, paths: "str | list[str]", expires_in: int = 3600, for_upload: bool = False
|
|
439
|
+
) -> "str | list[str]":
|
|
440
|
+
"""Generate signed URL(s) asynchronously."""
|
|
441
|
+
return await async_(self.sign_sync)(paths, expires_in, for_upload) # type: ignore[arg-type]
|