--- /dev/null
+.. change::
+ :tags: bug, postgresql
+ :tickets: 4041
+
+ 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.
_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):
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)
import datetime
from sqlalchemy import (
Table, Column, select, MetaData, text, Integer, String, Sequence, Numeric,
- DateTime, BigInteger, func, extract, SmallInteger, TypeDecorator)
+ DateTime, BigInteger, func, extract, SmallInteger, TypeDecorator, literal,
+ cast)
from sqlalchemy import exc, schema
from sqlalchemy.dialects.postgresql import base as postgresql
import logging
finally:
users.drop()
+ def test_quoted_name_bindparam_ok(self):
+ from sqlalchemy.sql.elements import quoted_name
+
+ with testing.db.connect() as conn:
+ eq_(
+ conn.scalar(
+ select(
+ [cast(
+ literal(quoted_name("some_name", False)), String)]
+ )
+ ),
+ "some_name"
+ )
+
def test_preexecute_passivedefault(self):
"""test that when we get a primary key column back from
reflecting a table which has a default value on it, we pre-