osule commented on a change in pull request #6354: [AIRFLOW-5664] Store 
timestamps with microseconds precision in GCSToPSQL
URL: https://github.com/apache/airflow/pull/6354#discussion_r393403324
 
 

 ##########
 File path: airflow/providers/google/cloud/operators/postgres_to_gcs.py
 ##########
 @@ -88,7 +90,7 @@ def convert_type(self, value, schema_type):
         Decimals are converted to floats. Times are converted to seconds.
         """
         if isinstance(value, (datetime.datetime, datetime.date)):
-            return time.mktime(value.timetuple())
+            return pendulum.parse(value.isoformat()).float_timestamp
 
 Review comment:
   You're correct that this is inefficient. 
   However, `value.timestamp` doesn't take timezone information into account.
   
   Now that I think of it, it should have been written as  or some other way
   
   ```
   return pendulum.timezone('UTC').convert(value).timestamp()
   ```
   

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to