Skip to content

Commit 7333cad

Browse files
authored
Revert Dataform workflow invocation dict normalization (#69161) (#70395)
The reverted change was meant to fix #53843 (invocation_config believed dropped when workflow_invocation is passed as a dict), but it is a wire-identical no-op: proto-plus already converts nested dicts recursively, and the pre- and post-change requests serialize byte-identically, so the dict path never dropped the config. The reported symptom came from dataform-core 3.0.10-3.0.16 defaulting incremental tables to protected=true (silently disabling full refresh server-side; fixed upstream in core 3.0.17 via dataform-co/dataform#1942). #53843 is closed as not planned. The accompanying test only pinned third-party proto-plus conversion behavior, which our testing standards exclude.
1 parent 0b3aacc commit 7333cad

2 files changed

Lines changed: 1 addition & 24 deletions

File tree

‎providers/google/src/airflow/providers/google/cloud/hooks/dataform.py‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,6 @@ def create_workflow_invocation(
187187
"""
188188
client = self.get_dataform_client()
189189
parent = f"projects/{project_id}/locations/{region}/repositories/{repository_id}"
190-
if isinstance(workflow_invocation, dict):
191-
workflow_invocation = WorkflowInvocation(workflow_invocation)
192190
return client.create_workflow_invocation(
193191
request={"parent": parent, "workflow_invocation": workflow_invocation},
194192
retry=retry,

‎providers/google/tests/unit/google/cloud/hooks/test_dataform.py‎

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@
5050
f"{REPOSITORY_ID}/compilationResults/{COMPILATION_RESULT_ID}"
5151
),
5252
}
53-
FULL_REFRESH_WORKFLOW_INVOCATION = {
54-
**WORKFLOW_INVOCATION,
55-
"invocation_config": {
56-
"fully_refresh_incremental_tables_enabled": True,
57-
},
58-
}
5953
WORKFLOW_INVOCATION_ID = "test_workflow_invocation_id"
6054
PATH_TO_FOLDER = "path/to/folder"
6155
FILEPATH = "path/to/file.txt"
@@ -119,27 +113,12 @@ def test_create_workflow_invocation(self, mock_client):
119113
)
120114
parent = f"projects/{PROJECT_ID}/locations/{REGION}/repositories/{REPOSITORY_ID}"
121115
mock_client.return_value.create_workflow_invocation.assert_called_once_with(
122-
request=dict(parent=parent, workflow_invocation=WorkflowInvocation(WORKFLOW_INVOCATION)),
116+
request=dict(parent=parent, workflow_invocation=WORKFLOW_INVOCATION),
123117
retry=DEFAULT,
124118
timeout=None,
125119
metadata=(),
126120
)
127121

128-
@mock.patch(DATAFORM_STRING.format("DataformHook.get_dataform_client"))
129-
def test_create_workflow_invocation_preserves_invocation_config_from_dict(self, mock_client):
130-
self.hook.create_workflow_invocation(
131-
project_id=PROJECT_ID,
132-
region=REGION,
133-
repository_id=REPOSITORY_ID,
134-
workflow_invocation=FULL_REFRESH_WORKFLOW_INVOCATION,
135-
)
136-
137-
request = mock_client.return_value.create_workflow_invocation.call_args.kwargs["request"]
138-
workflow_invocation = request["workflow_invocation"]
139-
assert isinstance(workflow_invocation, WorkflowInvocation)
140-
assert workflow_invocation.compilation_result == WORKFLOW_INVOCATION["compilation_result"]
141-
assert workflow_invocation.invocation_config.fully_refresh_incremental_tables_enabled is True
142-
143122
@mock.patch(DATAFORM_STRING.format("DataformHook.get_dataform_client"))
144123
def test_get_workflow_invocation(self, mock_client):
145124
self.hook.get_workflow_invocation(

0 commit comments

Comments
 (0)