We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Migrated issue, originally created by Pierre Kephas (@kephas)
Hello,
I have a table with a JSONB column :
meta = sa.Column('metadata', sa.ext.mutable.MutableDict.as_mutable(sa.dialects.postgresql.JSONB), nullable=True, server_default='{}')
And I want a GIN index on the some_key key (see https://www.postgresql.org/docs/current/static/datatype-json.html#JSON-INDEXING if you do not know a lot about GIN indexes).
some_key
I declared :
__table_args__ = ( sa.Index( 'ix_table_metadata_some_key', sa.text('''(metadata->'some_key')'''), postgresql_using='gin', ) )
Then, running alembic revision -m "Some message" --autogenerate generates an empty migration.
alembic revision -m "Some message" --autogenerate
Note: creating a GIN index on meta column works fine.
meta
The text was updated successfully, but these errors were encountered:
Michael Bayer (@zzzeek) wrote:
you will note the warning:
alembic/util/messaging.py:69: UserWarning: autogenerate skipping functional index ix_table_metadata_some_key; not supported by SQLAlchemy reflection
that is, autogenerate has no way to know if this index already exists in the database. This behavior was added to #282.
You'll need to add this index to your migration script manually.
Sorry, something went wrong.
Pierre Kephas (@kephas) wrote:
Hi,
Thanks for your answer.
Yes, I noted the warning, but I forgot to mention it (sorry).
Well, I guess that detecting functional indexes is not easy... But anyway, I already added to my migration script manually. :)
sorry!
Changes by Michael Bayer (@zzzeek):
No branches or pull requests
Migrated issue, originally created by Pierre Kephas (@kephas)
Hello,
I have a table with a JSONB column :
And I want a GIN index on the
some_key
key (see https://www.postgresql.org/docs/current/static/datatype-json.html#JSON-INDEXING if you do not know a lot about GIN indexes).I declared :
Then, running
alembic revision -m "Some message" --autogenerate
generates an empty migration.Note: creating a GIN index on
meta
column works fine.The text was updated successfully, but these errors were encountered: