sqlspec 0.24.0__tar.gz → 0.24.1__tar.gz
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.
Potentially problematic release.
This version of sqlspec might be problematic. Click here for more details.
- {sqlspec-0.24.0 → sqlspec-0.24.1}/.pre-commit-config.yaml +1 -1
- {sqlspec-0.24.0 → sqlspec-0.24.1}/PKG-INFO +1 -1
- {sqlspec-0.24.0 → sqlspec-0.24.1}/pyproject.toml +1 -1
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/_sql.py +10 -8
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_sql_factory.py +163 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_correlation.py +1 -1
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_type_guards.py +1 -1
- {sqlspec-0.24.0 → sqlspec-0.24.1}/uv.lock +328 -312
- {sqlspec-0.24.0 → sqlspec-0.24.1}/.gitignore +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/CONTRIBUTING.rst +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/LICENSE +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/Makefile +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/NOTICE +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/README.md +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/__main__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/__metadata__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/_serialization.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/_typing.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/adbc/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/adbc/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/adbc/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/adbc/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/aiosqlite/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/aiosqlite/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/aiosqlite/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/aiosqlite/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/aiosqlite/pool.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/asyncmy/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/asyncmy/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/asyncmy/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/asyncmy/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/asyncpg/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/asyncpg/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/asyncpg/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/asyncpg/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/bigquery/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/bigquery/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/bigquery/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/bigquery/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/duckdb/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/duckdb/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/duckdb/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/duckdb/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/duckdb/pool.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/oracledb/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/oracledb/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/oracledb/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/oracledb/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/oracledb/migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/psqlpy/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/psqlpy/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/psqlpy/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/psqlpy/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/psycopg/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/psycopg/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/psycopg/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/psycopg/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/sqlite/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/sqlite/_types.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/sqlite/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/sqlite/driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/adapters/sqlite/pool.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/base.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_base.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_column.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_ddl.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_delete.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_expression_wrappers.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_insert.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_merge.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_parsing_utils.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_select.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/_update.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_cte_and_set_ops.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_delete_operations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_insert_operations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_join_operations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_merge_operations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_order_limit_operations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_pivot_operations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_select_operations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_update_operations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/builder/mixins/_where_clause.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/cli.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/core/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/core/cache.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/core/compiler.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/core/filters.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/core/hashing.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/core/parameters.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/core/result.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/core/splitter.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/core/statement.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/driver/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/driver/_async.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/driver/_common.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/driver/_sync.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/driver/mixins/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/driver/mixins/_result_tools.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/driver/mixins/_sql_translator.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/exceptions.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/aiosql/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/aiosql/adapter.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/litestar/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/litestar/_utils.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/litestar/cli.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/litestar/config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/litestar/handlers.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/litestar/plugin.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/extensions/litestar/providers.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/loader.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/migrations/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/migrations/base.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/migrations/commands.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/migrations/loaders.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/migrations/runner.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/migrations/tracker.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/migrations/utils.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/protocols.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/py.typed +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/storage/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/storage/backends/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/storage/backends/base.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/storage/backends/fsspec.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/storage/backends/local.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/storage/backends/obstore.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/storage/registry.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/typing.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/correlation.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/data_transformation.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/deprecation.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/fixtures.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/logging.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/module_loader.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/serializers.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/singleton.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/sync_tools.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/text.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/sqlspec/utils/type_guards.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/asset_maintenance.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/ddls-mysql-collection.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/ddls-postgres-collection.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/example_usage.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/init.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-config.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-data_types.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-database_details.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-engines.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-hostname.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-plugins.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-process_list.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-resource-groups.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-schema_objects.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-table_details.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/collection-users.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/mysql/init.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/oracle.ddl.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-applications.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-aws_extension_dependency.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-aws_oracle_exists.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-bg_writer_stats.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-calculated_metrics.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-data_types.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-database_details.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-extensions.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-index_details.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-pglogical-details.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-privileges.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-replication_slots.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-replication_stats.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-schema_details.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-schema_objects.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-settings.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-source_details.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/collection-table_details.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/extended-collection-all-databases.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/postgres/init.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/readiness-check.sql +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/fixtures/sql_utils.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/test_adbc_arrow_features.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/test_adbc_backends.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/test_adbc_connection.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/test_adbc_driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/test_adbc_edge_cases.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/test_adbc_results.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/test_migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_adbc/test_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_aiosqlite/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_aiosqlite/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_aiosqlite/test_connection.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_aiosqlite/test_driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_aiosqlite/test_migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_aiosqlite/test_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_aiosqlite/test_pooling.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncmy/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncmy/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncmy/test_asyncmy_features.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncmy/test_config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncmy/test_driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncmy/test_migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncmy/test_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncpg/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncpg/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncpg/test_connection.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncpg/test_driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncpg/test_execute_many.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncpg/test_migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_asyncpg/test_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_bigquery/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_bigquery/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_bigquery/test_bigquery_features.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_bigquery/test_config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_bigquery/test_connection.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_bigquery/test_driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_duckdb/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_duckdb/test_connection.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_duckdb/test_driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_duckdb/test_execute_many.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_duckdb/test_migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_duckdb/test_mixed_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_duckdb/test_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_duckdb/test_pooling.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_duckdb/utils.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_oracledb/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_oracledb/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_oracledb/test_connection.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_oracledb/test_driver_async.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_oracledb/test_driver_sync.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_oracledb/test_execute_many.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_oracledb/test_migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_oracledb/test_oracle_features.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_oracledb/test_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psqlpy/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psqlpy/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psqlpy/test_connection.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psqlpy/test_driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psqlpy/test_migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psqlpy/test_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psqlpy/test_psqlpy_features.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psycopg/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psycopg/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psycopg/test_async_copy.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psycopg/test_connection.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psycopg/test_driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psycopg/test_execute_many.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psycopg/test_migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_psycopg/test_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_sqlite/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_sqlite/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_sqlite/test_driver.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_sqlite/test_migrations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_sqlite/test_parameter_styles.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_sqlite/test_pooling.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_adapters/test_sqlite/test_query_mixin.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_loader/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_loader/test_file_system_loading.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_migrations/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_storage/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/integration/test_storage/test_storage_integration.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_adapters/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_adapters/conftest.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_adapters/test_adapter_implementations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_adapters/test_async_adapters.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_adapters/test_sync_adapters.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_base/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_base/test_sql_integration.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_base/test_sqlspec_class.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_builder/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_builder/test_insert_builder.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_builder/test_lateral_joins.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_builder/test_parameter_naming.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_builder_parameter_naming.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_core/test_cache.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_core/test_compiler.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_core/test_filters.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_core/test_hashing.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_core/test_parameters.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_core/test_result.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_core/test_statement.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_cte_parameter_collisions.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_extensions/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_extensions/test_litestar/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_extensions/test_litestar/test_config.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_loader/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_loader/test_cache_integration.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_loader/test_fixtures_directory_loading.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_loader/test_loading_patterns.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_loader/test_sql_file_loader.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_migrations/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_migrations/test_migration.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_migrations/test_migration_commands.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_migrations/test_migration_execution.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_migrations/test_migration_runner.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_parsing_utils.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_storage/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_storage/test_fsspec_backend.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_storage/test_local_store.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_storage/test_obstore_backend.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_storage/test_storage_registry.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_data_transformation.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_deprecation.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_fixtures.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_logging.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_module_loader.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_serializers.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_singleton.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_sync_tools.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_utils/test_text.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tests/unit/test_where_or_operations.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tools/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tools/build_docs.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tools/local-infra.sh +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tools/pypi_readme.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tools/sphinx_ext/__init__.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tools/sphinx_ext/changelog.py +0 -0
- {sqlspec-0.24.0 → sqlspec-0.24.1}/tools/sphinx_ext/missing_references.py +0 -0
|
@@ -13,7 +13,7 @@ maintainers = [{ name = "Litestar Developers", email = "hello@litestar.dev" }]
|
|
|
13
13
|
name = "sqlspec"
|
|
14
14
|
readme = "README.md"
|
|
15
15
|
requires-python = ">=3.9, <4.0"
|
|
16
|
-
version = "0.24.
|
|
16
|
+
version = "0.24.1"
|
|
17
17
|
|
|
18
18
|
[project.urls]
|
|
19
19
|
Discord = "https://discord.gg/litestar"
|
|
@@ -137,21 +137,18 @@ class SQLFactory:
|
|
|
137
137
|
self.dialect = dialect
|
|
138
138
|
|
|
139
139
|
def __call__(self, statement: str, dialect: DialectType = None) -> "Any":
|
|
140
|
-
"""Create a SelectBuilder from a SQL string,
|
|
140
|
+
"""Create a SelectBuilder from a SQL string, or SQL object for DML with RETURNING.
|
|
141
141
|
|
|
142
142
|
Args:
|
|
143
143
|
statement: The SQL statement string.
|
|
144
|
-
parameters: Optional parameters for the query.
|
|
145
|
-
*filters: Optional filters.
|
|
146
|
-
config: Optional config.
|
|
147
144
|
dialect: Optional SQL dialect.
|
|
148
|
-
**kwargs: Additional parameters.
|
|
149
145
|
|
|
150
146
|
Returns:
|
|
151
|
-
SelectBuilder instance
|
|
147
|
+
SelectBuilder instance for SELECT/WITH statements,
|
|
148
|
+
SQL object for DML statements with RETURNING clause.
|
|
152
149
|
|
|
153
150
|
Raises:
|
|
154
|
-
SQLBuilderError: If the SQL is not a SELECT/CTE statement.
|
|
151
|
+
SQLBuilderError: If the SQL is not a SELECT/CTE/DML+RETURNING statement.
|
|
155
152
|
"""
|
|
156
153
|
|
|
157
154
|
try:
|
|
@@ -175,8 +172,13 @@ class SQLFactory:
|
|
|
175
172
|
builder = Select(dialect=dialect or self.dialect)
|
|
176
173
|
builder._expression = parsed_expr
|
|
177
174
|
return builder
|
|
175
|
+
|
|
176
|
+
if actual_type_str in {"INSERT", "UPDATE", "DELETE"} and parsed_expr.args.get("returning") is not None:
|
|
177
|
+
return SQL(statement)
|
|
178
|
+
|
|
178
179
|
msg = (
|
|
179
|
-
f"sql(...) only supports SELECT statements
|
|
180
|
+
f"sql(...) only supports SELECT statements or DML statements with RETURNING clause. "
|
|
181
|
+
f"Detected type: {actual_type_str}. "
|
|
180
182
|
f"Use sql.{actual_type_str.lower()}() instead."
|
|
181
183
|
)
|
|
182
184
|
raise SQLBuilderError(msg)
|
|
@@ -1575,3 +1575,166 @@ def test_querybuilder_parameter_conversion_preserves_functionality() -> None:
|
|
|
1575
1575
|
assert len(complex_stmt.parameters) == 2
|
|
1576
1576
|
assert "2023-01-01" in complex_stmt.parameters.values()
|
|
1577
1577
|
assert "click" in complex_stmt.parameters.values()
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
def test_sql_call_with_update_returning() -> None:
|
|
1581
|
+
"""Test that sql() accepts UPDATE statements with RETURNING clause."""
|
|
1582
|
+
update_sql = "UPDATE books SET title = :title, pages = :pages WHERE id = :id RETURNING *"
|
|
1583
|
+
query = sql(update_sql)
|
|
1584
|
+
|
|
1585
|
+
assert isinstance(query, SQL)
|
|
1586
|
+
assert query.returns_rows()
|
|
1587
|
+
assert "UPDATE" in query.sql.upper()
|
|
1588
|
+
assert "RETURNING" in query.sql.upper()
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
def test_sql_call_with_insert_returning() -> None:
|
|
1592
|
+
"""Test that sql() accepts INSERT statements with RETURNING clause."""
|
|
1593
|
+
insert_sql = "INSERT INTO books (title, pages) VALUES (:title, :pages) RETURNING id, title"
|
|
1594
|
+
query = sql(insert_sql)
|
|
1595
|
+
|
|
1596
|
+
assert isinstance(query, SQL)
|
|
1597
|
+
assert query.returns_rows()
|
|
1598
|
+
assert "INSERT" in query.sql.upper()
|
|
1599
|
+
assert "RETURNING" in query.sql.upper()
|
|
1600
|
+
|
|
1601
|
+
|
|
1602
|
+
def test_sql_call_with_delete_returning() -> None:
|
|
1603
|
+
"""Test that sql() accepts DELETE statements with RETURNING clause."""
|
|
1604
|
+
delete_sql = "DELETE FROM books WHERE id = :id RETURNING id, title"
|
|
1605
|
+
query = sql(delete_sql)
|
|
1606
|
+
|
|
1607
|
+
assert isinstance(query, SQL)
|
|
1608
|
+
assert query.returns_rows()
|
|
1609
|
+
assert "DELETE" in query.sql.upper()
|
|
1610
|
+
assert "RETURNING" in query.sql.upper()
|
|
1611
|
+
|
|
1612
|
+
|
|
1613
|
+
def test_sql_call_rejects_update_without_returning() -> None:
|
|
1614
|
+
"""Test that sql() rejects UPDATE statements without RETURNING clause."""
|
|
1615
|
+
update_sql = "UPDATE books SET title = :title WHERE id = :id"
|
|
1616
|
+
|
|
1617
|
+
with pytest.raises(SQLBuilderError) as exc_info:
|
|
1618
|
+
sql(update_sql)
|
|
1619
|
+
|
|
1620
|
+
assert "only supports SELECT statements or DML statements with RETURNING clause" in str(exc_info.value)
|
|
1621
|
+
assert "UPDATE" in str(exc_info.value)
|
|
1622
|
+
|
|
1623
|
+
|
|
1624
|
+
def test_sql_call_rejects_insert_without_returning() -> None:
|
|
1625
|
+
"""Test that sql() rejects INSERT statements without RETURNING clause."""
|
|
1626
|
+
insert_sql = "INSERT INTO books (title, pages) VALUES (:title, :pages)"
|
|
1627
|
+
|
|
1628
|
+
with pytest.raises(SQLBuilderError) as exc_info:
|
|
1629
|
+
sql(insert_sql)
|
|
1630
|
+
|
|
1631
|
+
assert "only supports SELECT statements or DML statements with RETURNING clause" in str(exc_info.value)
|
|
1632
|
+
assert "INSERT" in str(exc_info.value)
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
def test_sql_call_rejects_delete_without_returning() -> None:
|
|
1636
|
+
"""Test that sql() rejects DELETE statements without RETURNING clause."""
|
|
1637
|
+
delete_sql = "DELETE FROM books WHERE id = :id"
|
|
1638
|
+
|
|
1639
|
+
with pytest.raises(SQLBuilderError) as exc_info:
|
|
1640
|
+
sql(delete_sql)
|
|
1641
|
+
|
|
1642
|
+
assert "only supports SELECT statements or DML statements with RETURNING clause" in str(exc_info.value)
|
|
1643
|
+
assert "DELETE" in str(exc_info.value)
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
def test_sql_update_method_with_returning() -> None:
|
|
1647
|
+
"""Test that sql.update() returns Update builder for statements with RETURNING (use sql() for SQL object)."""
|
|
1648
|
+
from sqlspec.builder import Update
|
|
1649
|
+
|
|
1650
|
+
update_sql = "UPDATE books SET title = :title WHERE id = :id RETURNING *"
|
|
1651
|
+
query = sql.update(update_sql)
|
|
1652
|
+
|
|
1653
|
+
assert isinstance(query, Update)
|
|
1654
|
+
# For RETURNING statements, use sql() instead to get SQL object
|
|
1655
|
+
sql_query = sql(update_sql)
|
|
1656
|
+
assert isinstance(sql_query, SQL)
|
|
1657
|
+
assert sql_query.returns_rows()
|
|
1658
|
+
|
|
1659
|
+
|
|
1660
|
+
def test_sql_insert_method_with_returning() -> None:
|
|
1661
|
+
"""Test that sql.insert() returns Insert builder for statements with RETURNING (use sql() for SQL object)."""
|
|
1662
|
+
from sqlspec.builder import Insert
|
|
1663
|
+
|
|
1664
|
+
insert_sql = "INSERT INTO books (title) VALUES (:title) RETURNING id, title"
|
|
1665
|
+
query = sql.insert(insert_sql)
|
|
1666
|
+
|
|
1667
|
+
assert isinstance(query, Insert)
|
|
1668
|
+
# For RETURNING statements, use sql() instead to get SQL object
|
|
1669
|
+
sql_query = sql(insert_sql)
|
|
1670
|
+
assert isinstance(sql_query, SQL)
|
|
1671
|
+
assert sql_query.returns_rows()
|
|
1672
|
+
|
|
1673
|
+
|
|
1674
|
+
def test_sql_delete_method_with_returning() -> None:
|
|
1675
|
+
"""Test that sql.delete() returns Delete builder for statements with RETURNING (use sql() for SQL object)."""
|
|
1676
|
+
from sqlspec.builder import Delete
|
|
1677
|
+
|
|
1678
|
+
delete_sql = "DELETE FROM books WHERE id = :id RETURNING *"
|
|
1679
|
+
query = sql.delete(delete_sql)
|
|
1680
|
+
|
|
1681
|
+
assert isinstance(query, Delete)
|
|
1682
|
+
# For RETURNING statements, use sql() instead to get SQL object
|
|
1683
|
+
sql_query = sql(delete_sql)
|
|
1684
|
+
assert isinstance(sql_query, SQL)
|
|
1685
|
+
assert sql_query.returns_rows()
|
|
1686
|
+
|
|
1687
|
+
|
|
1688
|
+
def test_sql_update_method_without_returning_returns_builder() -> None:
|
|
1689
|
+
"""Test that sql.update() returns Update builder for statements without RETURNING."""
|
|
1690
|
+
from sqlspec.builder import Update
|
|
1691
|
+
|
|
1692
|
+
update_sql = "UPDATE books SET title = :title WHERE id = :id"
|
|
1693
|
+
query = sql.update(update_sql)
|
|
1694
|
+
|
|
1695
|
+
assert isinstance(query, Update)
|
|
1696
|
+
assert not isinstance(query, SQL)
|
|
1697
|
+
|
|
1698
|
+
|
|
1699
|
+
def test_sql_insert_method_without_returning_returns_builder() -> None:
|
|
1700
|
+
"""Test that sql.insert() returns Insert builder for statements without RETURNING."""
|
|
1701
|
+
from sqlspec.builder import Insert
|
|
1702
|
+
|
|
1703
|
+
insert_sql = "INSERT INTO books (title) VALUES (:title)"
|
|
1704
|
+
query = sql.insert(insert_sql)
|
|
1705
|
+
|
|
1706
|
+
assert isinstance(query, Insert)
|
|
1707
|
+
assert not isinstance(query, SQL)
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
def test_sql_delete_method_without_returning_returns_builder() -> None:
|
|
1711
|
+
"""Test that sql.delete() returns Delete builder for statements without RETURNING."""
|
|
1712
|
+
from sqlspec.builder import Delete
|
|
1713
|
+
|
|
1714
|
+
delete_sql = "DELETE FROM books WHERE id = :id"
|
|
1715
|
+
query = sql.delete(delete_sql)
|
|
1716
|
+
|
|
1717
|
+
assert isinstance(query, Delete)
|
|
1718
|
+
assert not isinstance(query, SQL)
|
|
1719
|
+
|
|
1720
|
+
|
|
1721
|
+
def test_select_statements_still_work_with_sql_call() -> None:
|
|
1722
|
+
"""Test that SELECT statements continue to work with sql()."""
|
|
1723
|
+
from sqlspec.builder import Select
|
|
1724
|
+
|
|
1725
|
+
select_sql = "SELECT * FROM books WHERE id = :id"
|
|
1726
|
+
query = sql(select_sql)
|
|
1727
|
+
|
|
1728
|
+
assert isinstance(query, Select)
|
|
1729
|
+
assert not isinstance(query, SQL)
|
|
1730
|
+
|
|
1731
|
+
|
|
1732
|
+
def test_with_statements_still_work_with_sql_call() -> None:
|
|
1733
|
+
"""Test that WITH statements continue to work with sql()."""
|
|
1734
|
+
from sqlspec.builder import Select
|
|
1735
|
+
|
|
1736
|
+
with_sql = "WITH ranked AS (SELECT *, ROW_NUMBER() OVER (ORDER BY id) as rn FROM books) SELECT * FROM ranked"
|
|
1737
|
+
query = sql(with_sql)
|
|
1738
|
+
|
|
1739
|
+
assert isinstance(query, Select)
|
|
1740
|
+
assert not isinstance(query, SQL)
|
|
@@ -270,7 +270,7 @@ def test_adapter_with_empty_extra() -> None:
|
|
|
270
270
|
|
|
271
271
|
CorrelationContext.set("test-id")
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
_msg, kwargs = adapter.process("Test message", {"extra": {}})
|
|
274
274
|
|
|
275
275
|
assert kwargs["extra"]["correlation_id"] == "test-id"
|
|
276
276
|
|
|
@@ -695,7 +695,7 @@ def test_extract_dataclass_fields_conflicting_include_exclude() -> None:
|
|
|
695
695
|
"""Test extract_dataclass_fields raises error for conflicting include/exclude."""
|
|
696
696
|
instance = SampleDataclass(name="test", age=25)
|
|
697
697
|
|
|
698
|
-
with pytest.raises(ValueError, match="Fields .* are both included and excluded"):
|
|
698
|
+
with pytest.raises(ValueError, match="Fields .* are both included and excluded"): # noqa: RUF043
|
|
699
699
|
extract_dataclass_fields(instance, include={"name"}, exclude={"name"})
|
|
700
700
|
|
|
701
701
|
|