Skip to content

Commit 6a18700

Browse files
committed
allows to disable lake formation
1 parent a98bb87 commit 6a18700

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

dlt/destinations/impl/athena/athena.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ def update_stored_schema(
348348
if (
349349
self.config.lakeformation_config is not None
350350
and self.config.lakeformation_config.enabled
351+
is not None # both True and False are actionable
351352
):
352353
self.manage_lf_tags()
353354
return applied_update

dlt/destinations/impl/athena/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
@configspec
1010
class LakeformationConfig:
11-
enabled: bool = False
11+
enabled: Optional[bool] = None
1212
tags: Optional[Dict[str, str]] = None
1313

1414

tests/load/athena_iceberg/test_lakeformation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ def create_pipelines(
186186
)
187187
lf_disabled_pipeline = destination_config.setup_pipeline(
188188
pipeline_name,
189-
destination=destination_config.destination_factory(),
189+
destination=destination_config.destination_factory(
190+
lakeformation_config=LakeformationConfig(enabled=False)
191+
),
190192
dataset_name=dataset_name,
191193
staging=staging_destination,
192194
)

tests/load/pipeline/test_athena.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,15 @@
3535
),
3636
ids=lambda x: x.name,
3737
)
38-
@pytest.mark.parametrize("lf_enabled", [True, False], ids=["lf-on", "lf-off"])
38+
@pytest.mark.parametrize(
39+
"lf_enabled", [True, False, None], ids=["lf-on", "lf-off", "lf-passthrough"]
40+
)
3941
def test_athena_lakeformation_config_gating(
4042
destination_config: DestinationTestConfiguration, lf_enabled: bool, mocker, monkeypatch
4143
) -> None:
4244
# Configure Lake Formation gating via env (read by client config)
43-
monkeypatch.setenv("DESTINATION__LAKEFORMATION_CONFIG__ENABLED", str(lf_enabled))
45+
if lf_enabled is not None:
46+
monkeypatch.setenv("DESTINATION__LAKEFORMATION_CONFIG__ENABLED", str(lf_enabled))
4447

4548
pipeline = destination_config.setup_pipeline("athena_" + uniq_id(), dev_mode=True)
4649

@@ -55,7 +58,8 @@ def test_athena_lakeformation_config_gating(
5558
)
5659

5760
client.update_stored_schema()
58-
if lf_enabled:
61+
# disable and enable flag with add / remove tags respectively, None will skip
62+
if lf_enabled is not None:
5963
mocked_manage.assert_called()
6064
else:
6165
mocked_manage.assert_not_called()

0 commit comments

Comments
 (0)