Skip to content

Commit b77232f

Browse files
sdks/python: fix linting issues
1 parent 42652ac commit b77232f

File tree

1 file changed

+3
-5
lines changed
  • sdks/python/apache_beam/transforms/enrichment_handlers

1 file changed

+3
-5
lines changed

sdks/python/apache_beam/transforms/enrichment_handlers/cloudsql.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,12 @@ def _execute_query(
326326
try:
327327
result = connection.execute(text(query), **params)
328328
# Materialize results while transaction is active.
329+
data: Union[List[Dict[str, Any]], Dict[str, Any]]
329330
if is_batch:
330-
data: List[Dict[str, Any]] = [row._asdict() for row in result]
331+
data = [row._asdict() for row in result]
331332
else:
332333
result_row = result.first()
333-
if result_row:
334-
data: Dict[str, Any] = result_row._asdict()
335-
else:
336-
data = {}
334+
data = result_row._asdict() if result_row else {}
337335
# Explicitly commit the transaction.
338336
transaction.commit()
339337
return data

0 commit comments

Comments
 (0)