data-factory-utils 2.2.0__tar.gz → 2.3.0__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.
- {data_factory_utils-2.2.0 → data_factory_utils-2.3.0}/PKG-INFO +1 -1
- {data_factory_utils-2.2.0 → data_factory_utils-2.3.0}/pyproject.toml +1 -1
- {data_factory_utils-2.2.0 → data_factory_utils-2.3.0}/src/data_factory_utils/query.py +10 -6
- {data_factory_utils-2.2.0 → data_factory_utils-2.3.0}/README.md +0 -0
- {data_factory_utils-2.2.0 → data_factory_utils-2.3.0}/src/data_factory_utils/__init__.py +0 -0
- {data_factory_utils-2.2.0 → data_factory_utils-2.3.0}/src/data_factory_utils/athena.py +0 -0
- {data_factory_utils-2.2.0 → data_factory_utils-2.3.0}/src/data_factory_utils/environment.py +0 -0
|
@@ -89,7 +89,7 @@ class WhereSetMembership(NamedTuple):
|
|
|
89
89
|
"""Config for WHERE IN comparisons."""
|
|
90
90
|
|
|
91
91
|
col: str
|
|
92
|
-
set: tuple[str]
|
|
92
|
+
set: tuple[str] | Subquery
|
|
93
93
|
unquote: bool | None = False
|
|
94
94
|
prefix: Literal["AND", "OR", "NOT"] | None = "AND"
|
|
95
95
|
brackets: Literal["open", "close", "wrap"] | None = None
|
|
@@ -529,10 +529,14 @@ def _build_where_set_membership(config: WhereSetMembership) -> str:
|
|
|
529
529
|
- WHERE NOT col IN (value, value)
|
|
530
530
|
"""
|
|
531
531
|
validate_identifier(config.col)
|
|
532
|
-
|
|
533
|
-
|
|
532
|
+
if not isinstance(config.set, Subquery):
|
|
533
|
+
for value in config.set:
|
|
534
|
+
validate_identifier(value)
|
|
534
535
|
|
|
535
|
-
if config.
|
|
536
|
+
if isinstance(config.set, Subquery):
|
|
537
|
+
values = str(config.set)
|
|
538
|
+
query_str = f"{config.col} IN {values}"
|
|
539
|
+
elif config.unquote:
|
|
536
540
|
values = ", ".join(config.set)
|
|
537
541
|
query_str = f"{config.col} IN ({values})"
|
|
538
542
|
else:
|
|
@@ -733,8 +737,8 @@ class Query:
|
|
|
733
737
|
msg = "WHERE statement has no valid conditions."
|
|
734
738
|
raise ValueError(msg)
|
|
735
739
|
|
|
736
|
-
# first condition cannot have prefix
|
|
737
|
-
if i > 0 and condition.prefix:
|
|
740
|
+
# first condition cannot have prefix - unless it's "NOT"
|
|
741
|
+
if (i == 0 and condition.prefix == "NOT") or (i > 0 and condition.prefix):
|
|
738
742
|
cond_str = f"{condition.prefix} {cond_str}"
|
|
739
743
|
|
|
740
744
|
query_str.append(cond_str)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|