Skip to content
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
Closed

Incorrect autogeneration for postgresql.HSTORE #480

sqlalchemy-bot opened this issue Jan 26, 2018 · 3 comments
Labels
autogenerate - rendering bug Something isn't working

Comments

@sqlalchemy-bot
Copy link

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
Copy link
Author

Michael Bayer (@zzzeek) wrote:

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

@sqlalchemy-bot
Copy link
Author

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
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added autogenerate - rendering bug Something isn't working labels Nov 27, 2018
vvvrrooomm pushed a commit to vvvrrooomm/alembic that referenced this issue Jan 10, 2019
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: sqlalchemy#480
vvvrrooomm pushed a commit to vvvrrooomm/alembic that referenced this issue Jan 10, 2019
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: sqlalchemy#480
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autogenerate - rendering bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant