import re
from uuid import UUID as _python_UUID
+from .array import ARRAY as PGARRAY
+from .base import _ColonCast
from .base import _DECIMAL_TYPES
from .base import _FLOAT_TYPES
from .base import _INT_TYPES
return dbapi.BOOLEAN
+class _PGARRAY(PGARRAY):
+ def bind_expression(self, bindvalue):
+ return _ColonCast(bindvalue, self)
+
+
_server_side_id = util.counter()
sqltypes.SmallInteger: _PGSmallInteger,
sqltypes.BigInteger: _PGBigInteger,
sqltypes.Enum: _PGEnum,
+ sqltypes.ARRAY: _PGARRAY,
},
)
try:
return dialect._type_memos[self]["impl"]
except KeyError:
- return self._dialect_info(dialect)["impl"]
+ pass
+ return self._dialect_info(dialect)["impl"]
def _unwrapped_dialect_impl(self, dialect):
"""Return the 'unwrapped' dialect impl for this type.
__only_on__ = "postgresql"
__backend__ = True
- __unsupported_on__ = ("postgresql+pg8000",)
ARRAY = postgresql.ARRAY
(sqltypes.Unicode, unicode_values),
(postgresql.JSONB, json_values),
(sqltypes.Boolean, lambda x: [False] + [True] * x),
- (
- sqltypes.LargeBinary,
- binary_values,
- ),
- (
- postgresql.BYTEA,
- binary_values,
- ),
+ (sqltypes.LargeBinary, binary_values),
+ (postgresql.BYTEA, binary_values),
(
postgresql.INET,
lambda x: [
(postgresql.ENUM(AnEnum), enum_values),
(sqltypes.Enum(AnEnum, native_enum=True), enum_values),
(sqltypes.Enum(AnEnum, native_enum=False), enum_values),
+ (postgresql.ENUM(AnEnum, native_enum=True), enum_values),
]
if not exclude_json:
]
)
+ _pg8000_skip_types = {
+ postgresql.HSTORE, # return not parsed returned as string
+ }
+ for i in range(len(elements)):
+ elem = elements[i]
+ if (
+ elem[0] in _pg8000_skip_types
+ or type(elem[0]) in _pg8000_skip_types
+ ):
+ elem += (
+ testing.skip_if(
+ "postgresql+pg8000", "type not supported by pg8000"
+ ),
+ )
+ elements[i] = elem
+
return testing.combinations_list(
elements, argnames="type_,gen", id_="na"
)