sqlspec 0.24.0__py3-none-any.whl → 0.25.0__py3-none-any.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.
Potentially problematic release.
This version of sqlspec might be problematic. Click here for more details.
- sqlspec/_sql.py +21 -23
- sqlspec/_typing.py +2 -0
- sqlspec/adapters/adbc/driver.py +2 -2
- sqlspec/adapters/oracledb/driver.py +5 -0
- sqlspec/adapters/psycopg/config.py +2 -4
- sqlspec/base.py +3 -4
- sqlspec/builder/_base.py +55 -13
- sqlspec/builder/_column.py +9 -0
- sqlspec/builder/_ddl.py +7 -7
- sqlspec/builder/_insert.py +10 -6
- sqlspec/builder/_parsing_utils.py +23 -4
- sqlspec/builder/_update.py +1 -1
- sqlspec/builder/mixins/_cte_and_set_ops.py +31 -22
- sqlspec/builder/mixins/_delete_operations.py +12 -7
- sqlspec/builder/mixins/_insert_operations.py +50 -36
- sqlspec/builder/mixins/_join_operations.py +1 -0
- sqlspec/builder/mixins/_merge_operations.py +54 -28
- sqlspec/builder/mixins/_order_limit_operations.py +1 -0
- sqlspec/builder/mixins/_pivot_operations.py +1 -0
- sqlspec/builder/mixins/_select_operations.py +42 -14
- sqlspec/builder/mixins/_update_operations.py +30 -18
- sqlspec/builder/mixins/_where_clause.py +48 -60
- sqlspec/core/__init__.py +3 -2
- sqlspec/core/cache.py +297 -351
- sqlspec/core/compiler.py +5 -3
- sqlspec/core/filters.py +246 -213
- sqlspec/core/hashing.py +9 -11
- sqlspec/core/parameters.py +20 -7
- sqlspec/core/statement.py +67 -12
- sqlspec/driver/_async.py +2 -2
- sqlspec/driver/_common.py +31 -14
- sqlspec/driver/_sync.py +2 -2
- sqlspec/driver/mixins/_result_tools.py +60 -7
- sqlspec/loader.py +8 -9
- sqlspec/storage/backends/fsspec.py +1 -0
- sqlspec/typing.py +2 -0
- {sqlspec-0.24.0.dist-info → sqlspec-0.25.0.dist-info}/METADATA +1 -1
- {sqlspec-0.24.0.dist-info → sqlspec-0.25.0.dist-info}/RECORD +42 -42
- {sqlspec-0.24.0.dist-info → sqlspec-0.25.0.dist-info}/WHEEL +0 -0
- {sqlspec-0.24.0.dist-info → sqlspec-0.25.0.dist-info}/entry_points.txt +0 -0
- {sqlspec-0.24.0.dist-info → sqlspec-0.25.0.dist-info}/licenses/LICENSE +0 -0
- {sqlspec-0.24.0.dist-info → sqlspec-0.25.0.dist-info}/licenses/NOTICE +0 -0
sqlspec/core/compiler.py
CHANGED
|
@@ -171,7 +171,7 @@ class SQLProcessor:
|
|
|
171
171
|
if not self._config.enable_caching:
|
|
172
172
|
return self._compile_uncached(sql, parameters, is_many)
|
|
173
173
|
|
|
174
|
-
cache_key = self._make_cache_key(sql, parameters)
|
|
174
|
+
cache_key = self._make_cache_key(sql, parameters, is_many)
|
|
175
175
|
|
|
176
176
|
if cache_key in self._cache:
|
|
177
177
|
result = self._cache[cache_key]
|
|
@@ -216,7 +216,7 @@ class SQLProcessor:
|
|
|
216
216
|
if self._config.parameter_config.needs_static_script_compilation and processed_params is None:
|
|
217
217
|
sqlglot_sql = processed_sql
|
|
218
218
|
else:
|
|
219
|
-
sqlglot_sql, _ = self._parameter_processor.
|
|
219
|
+
sqlglot_sql, _ = self._parameter_processor.get_sqlglot_compatible_sql(
|
|
220
220
|
sql, parameters, self._config.parameter_config, dialect_str
|
|
221
221
|
)
|
|
222
222
|
|
|
@@ -273,12 +273,13 @@ class SQLProcessor:
|
|
|
273
273
|
logger.warning("Compilation failed, using fallback: %s", e)
|
|
274
274
|
return CompiledSQL(compiled_sql=sql, execution_parameters=parameters, operation_type="UNKNOWN")
|
|
275
275
|
|
|
276
|
-
def _make_cache_key(self, sql: str, parameters: Any) -> str:
|
|
276
|
+
def _make_cache_key(self, sql: str, parameters: Any, is_many: bool = False) -> str:
|
|
277
277
|
"""Generate cache key.
|
|
278
278
|
|
|
279
279
|
Args:
|
|
280
280
|
sql: SQL string
|
|
281
281
|
parameters: Parameter values
|
|
282
|
+
is_many: Whether this is for execute_many operation
|
|
282
283
|
|
|
283
284
|
Returns:
|
|
284
285
|
Cache key string
|
|
@@ -295,6 +296,7 @@ class SQLProcessor:
|
|
|
295
296
|
dialect_str,
|
|
296
297
|
self._config.enable_parsing,
|
|
297
298
|
self._config.enable_transformations,
|
|
299
|
+
is_many,
|
|
298
300
|
)
|
|
299
301
|
|
|
300
302
|
hash_str = hashlib.sha256(str(hash_data).encode("utf-8")).hexdigest()[:16]
|