kaxil closed pull request #2273: [AIRFLOW-1171] Fix up encoding for Postgres
URL: https://github.com/apache/incubator-airflow/pull/2273
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/hooks/postgres_hook.py b/airflow/hooks/postgres_hook.py
index 4b460c1158..6ab9ea7110 100644
--- a/airflow/hooks/postgres_hook.py
+++ b/airflow/hooks/postgres_hook.py
@@ -67,4 +67,9 @@ def _serialize_cell(cell, conn):
:rtype: str
"""
- return psycopg2.extensions.adapt(cell).getquoted().decode('utf-8')
+ adapted = psycopg2.extensions.adapt(cell)
+ try:
+ adapted.prepare(conn)
+ except AttributeError:
+ pass
+ return adapted.getquoted()
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services