summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/dialects/postgresql/pg8000.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-08-08 13:30:49 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2017-08-08 17:25:28 -0400
commit03560c4b83308719067ec635662c35f9a437fb7f (patch)
tree14ea8351c88834e08cd8c38ec62d879b1b8e226d /lib/sqlalchemy/dialects/postgresql/pg8000.py
parent725298ea4bdd874990940ca93c406ccb533c732d (diff)
downloadsqlalchemy-03560c4b83308719067ec635662c35f9a437fb7f.tar.gz
Add quoted_name to pg8000 py_types
Fixed bug where the pg8000 driver would fail if using :meth:`.MetaData.reflect` with a schema name, since the schema name would be sent as a "quoted_name" object that's a string subclass, which pg8000 doesn't recognize. The quoted_name type is added to pg8000's py_types collection on connect. Change-Id: Id0f838320cb66563685e094e4eae2d5116100d27 Fixes: #4041
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/pg8000.py')
-rw-r--r--lib/sqlalchemy/dialects/postgresql/pg8000.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/pg8000.py b/lib/sqlalchemy/dialects/postgresql/pg8000.py
index 8c019a26d..5f6cd0a3f 100644
--- a/lib/sqlalchemy/dialects/postgresql/pg8000.py
+++ b/lib/sqlalchemy/dialects/postgresql/pg8000.py
@@ -73,6 +73,7 @@ from .base import (
_DECIMAL_TYPES, _FLOAT_TYPES, _INT_TYPES)
import re
from sqlalchemy.dialects.postgresql.json import JSON
+from ...sql.elements import quoted_name
class _PGNumeric(sqltypes.Numeric):
@@ -244,6 +245,11 @@ class PGDialect_pg8000(PGDialect):
def on_connect(self):
fns = []
+
+ def on_connect(conn):
+ conn.py_types[quoted_name] = conn.py_types[unicode]
+ fns.append(on_connect)
+
if self.client_encoding is not None:
def on_connect(conn):
self.set_client_encoding(conn, self.client_encoding)