return False
+ def _render_HSTORE_type(self, type_, autogen_context):
+ return render._render_type_w_subtype(
+ type_, autogen_context, 'text_type', r'(.+?\(.*text_type=)'
+ )
+
def _render_ARRAY_type(self, type_, autogen_context):
return render._render_type_w_subtype(
type_, autogen_context, 'item_type', r'(.+?\()'
--- /dev/null
+.. change::
+ :tags: bug, postgresql
+ :tickets: 480
+
+ Fixed the autogenerate of the module prefix
+ when rendering the text_type parameter of
+ postgresql.HSTORE, in much the same way that
+ we do for ARRAY's type and JSON's text_type.
if util.sqla_09:
- from sqlalchemy.dialects.postgresql import JSON, JSONB
+ from sqlalchemy.dialects.postgresql import JSON, JSONB, HSTORE
class PostgresqlOpTest(TestBase):
assert 'from sqlalchemy.dialects import postgresql' in \
self.autogen_context.imports
+ @config.requirements.sqlalchemy_110
+ def test_postgresql_hstore_subtypes(self):
+ eq_ignore_whitespace(
+ autogenerate.render._repr_type(
+ HSTORE(), self.autogen_context),
+ "postgresql.HSTORE(text_type=sa.Text())"
+ )
+
+ eq_ignore_whitespace(
+ autogenerate.render._repr_type(
+ HSTORE(text_type=String()), self.autogen_context),
+ "postgresql.HSTORE(text_type=sa.String())"
+ )
+
+ eq_ignore_whitespace(
+ autogenerate.render._repr_type(
+ HSTORE(text_type=BYTEA()), self.autogen_context),
+ "postgresql.HSTORE(text_type=postgresql.BYTEA())"
+ )
+
+ assert 'from sqlalchemy.dialects import postgresql' in \
+ self.autogen_context.imports
+
@config.requirements.sqlalchemy_110
def test_generic_array_type(self):