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

op.create_table emit_events arg is an invalid argument #81

Closed
sqlalchemy-bot opened this issue Oct 20, 2012 · 2 comments
Closed

op.create_table emit_events arg is an invalid argument #81

sqlalchemy-bot opened this issue Oct 20, 2012 · 2 comments
Labels
bug Something isn't working

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Robert Kopaczewski (@23doors)

According to docs, emit_events=True should imply that before_create and after_create events will be emitted.

That's not the case.

op.create_table('role',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=80), nullable=True),
sa.Column('description', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('id'),
emit_events=True
)

Results in:
TypeError: Invalid argument(s) for Table: ['emit_events']

Is there some other way to create custom indexes with alembic?

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

that documentation note is apparently an inadvertent checkin, is removed in 894afbf.

The feature it discusses is more related to PG's ENUM type, which can now be created directly now. Alembic fires off the before_create() and after_create() events for CreateTable in all cases. However, using these kinds of events directly in an Alembic script just makes the script more complicated, as an alembic script is just a straight list of DDL to emit, you just add any additional DDL inline.

The term "custom indexes" can mean several things. If it means, you just want to create an index explicitly, you just use op.create_index(). If it means, you want to create an index that makes use of some unsupported syntax, like a Postgresql functional index, you write out the "CREATE INDEX" statement as a string and invoke it via op.execute().

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot sqlalchemy-bot added the bug Something isn't working label Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant