You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "hussein-awala (via GitHub)" <gi...@apache.org> on 2023/08/29 20:33:13 UTC

[GitHub] [airflow] hussein-awala commented on a diff in pull request #33857: replace unnecessary dict comprehension by dict() in providers

hussein-awala commented on code in PR #33857:
URL: https://github.com/apache/airflow/pull/33857#discussion_r1309288674


##########
airflow/providers/google/cloud/operators/bigquery.py:
##########
@@ -1039,7 +1039,7 @@ def execute(self, context: Context):
             self.log.info("Total extracted rows: %s", len(rows))
 
             if self.as_dict:
-                table_data = [{k: v for k, v in row.items()} for row in rows]
+                table_data = [dict(row.items()) for row in rows]

Review Comment:
   It is enough!
   ```python
   >>> from google.cloud.bigquery.table import Row
   >>> row = Row(('a', 'b'), {'x': 0, 'y': 1})
   >>> dict(row)
   {'x': 'a', 'y': 'b'}
   >>> dict(row.items())
   {'x': 'a', 'y': 'b'}
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org