[GitHub] [airflow] feluelle commented on a change in pull request #5196: [AIRFLOW-4423] Improve date handling in mysql to gcs operator.

2019-04-28 Thread GitBox
feluelle commented on a change in pull request #5196: [AIRFLOW-4423] Improve 
date handling in mysql to gcs operator.
URL: https://github.com/apache/airflow/pull/5196#discussion_r279184388
 
 

 ##
 File path: tests/contrib/operators/test_mysql_to_gcs_operator.py
 ##
 @@ -106,7 +121,7 @@ def _assert_upload(bucket, obj, tmp_filename, 
mime_type=None):
 op.execute(None)
 
 
mysql_hook_mock_class.assert_called_once_with(mysql_conn_id=MYSQL_CONN_ID)
-
mysql_hook_mock.get_conn().cursor().execute.assert_called_once_with(SQL)
+mysql_hook_mock.get_conn().cursor().execute.assert_called_with(SQL)
 
 Review comment:
   Please test that you executed the `tz_query` before you execute the actual 
`sql` statement. You can test that via 
[assert_has_calls](https://docs.python.org/3.6/library/unittest.mock.html#unittest.mock.Mock.assert_has_calls).
 Also see this https://github.com/apache/airflow/pull/5101#discussion_r275438792


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] feluelle commented on a change in pull request #5196: [AIRFLOW-4423] Improve date handling in mysql to gcs operator.

2019-04-28 Thread GitBox
feluelle commented on a change in pull request #5196: [AIRFLOW-4423] Improve 
date handling in mysql to gcs operator.
URL: https://github.com/apache/airflow/pull/5196#discussion_r279183742
 
 

 ##
 File path: airflow/contrib/operators/mysql_to_gcs.py
 ##
 @@ -265,27 +288,31 @@ def _upload_to_gcs(self, files_to_upload):
 tmp_file.get('file_handle').name,
 mime_type=tmp_file.get('file_mime_type'))
 
-@staticmethod
-def _convert_types(schema, col_type_dict, row):
+@classmethod
+def _convert_types(cls, schema, col_type_dict, row):
+return [
+cls._convert_type(value, col_type_dict.get(name))
+for name, value in zip(schema, row)
+]
+
+@classmethod
+def _convert_type(cls, value, schema_type):
 
 Review comment:
   The documentation for this conversion is good, but in my opinion we should 
always document the parameters as well + to have a cleaner sphinx generated 
documentation. :)


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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services