New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect autogeneration for postgresql.HSTORE #480

Closed
sqlalchemy-bot opened this Issue Jan 26, 2018 · 3 comments

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Jan 26, 2018

Migrated issue, originally created by jahs (@jahs)

Hi, just a little import bug. The model (JSON column given for comparison purposes):

from sqlalchemy.dialects import postgresql as pg
t = sa.Table('spam', target_metadata,
             sa.Column('eggs', pg.JSON),
             sa.Column('ham', pg.HSTORE))

produces:

    op.create_table('spam',
    sa.Column('eggs', postgresql.JSON(astext_type=sa.Text()), nullable=True),
    sa.Column('ham', postgresql.HSTORE(text_type=Text()), nullable=True)
    )

which when run gives a traceback terminating with:

    sa.Column('ham', postgresql.HSTORE(text_type=Text()), nullable=True)
NameError: name 'Text' is not defined

simply changing to Text() to sa.Text() as per JSON fixes it.

Using alembic==0.9.8.dev0, SQLAlchemy==1.2.1, psycopg2==2.7.3.2.

Thanks.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jan 26, 2018

Michael Bayer (@zzzeek) wrote:

these are small at this point. funny how i keep missing them (JSON, JSONB, ARRAY ...)

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jan 26, 2018

Michael Bayer (@zzzeek) wrote:

Add HSTORE to render_type_w_subtype

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.

Change-Id: Ie8c2cdd1f4aeebcbb306c7f74168f8ac33688b1a
Fixes: #480

d4755d5

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Jan 26, 2018

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment