You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/01/10 22:49:07 UTC

[GitHub] stale[bot] closed pull request #3850: [AIRFLOW-3010] added support for date format to postgres_to_gcs_operator

stale[bot] closed pull request #3850: [AIRFLOW-3010] added support for date format to postgres_to_gcs_operator
URL: https://github.com/apache/airflow/pull/3850
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/contrib/operators/postgres_to_gcs_operator.py b/airflow/contrib/operators/postgres_to_gcs_operator.py
index 88b4d00e39..505ad7e815 100644
--- a/airflow/contrib/operators/postgres_to_gcs_operator.py
+++ b/airflow/contrib/operators/postgres_to_gcs_operator.py
@@ -207,8 +207,10 @@ def convert_types(cls, value):
         JSON/Google Cloud Storage/BigQuery. Dates are converted to UTC seconds.
         Decimals are converted to floats. Times are converted to seconds.
         """
-        if type(value) in (datetime.datetime, datetime.date):
+        if type(value) == datetime.datetime:
             return time.mktime(value.timetuple())
+        elif type(value) == datetime.date:
+            return value.strftime('%Y-%m-%d')
         elif type(value) == datetime.time:
             formated_time = time.strptime(str(value), "%H:%M:%S")
             return datetime.timedelta(
@@ -229,8 +231,8 @@ def type_map(cls, postgres_type):
         d = {
             1114: 'TIMESTAMP',
             1184: 'TIMESTAMP',
-            1082: 'TIMESTAMP',
             1083: 'TIMESTAMP',
+            1082: 'DATE',
             1005: 'INTEGER',
             1007: 'INTEGER',
             1016: 'INTEGER',


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services