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

batch_op.alter_column fails for server_default=None #361

Closed
sqlalchemy-bot opened this issue Mar 16, 2016 · 3 comments
Closed

batch_op.alter_column fails for server_default=None #361

sqlalchemy-bot opened this issue Mar 16, 2016 · 3 comments

Comments

@sqlalchemy-bot
Copy link

@sqlalchemy-bot sqlalchemy-bot commented Mar 16, 2016

Migrated issue, originally created by Martin Domke (@mdomke)

It is currently not possible to delete an existing server default when using batch_alter_table() by setting the server_default keyword-parameter to None. The migration will fail with an

sqlalchemy.exc.ArgumentError: Argument 'arg' is expected to be one of type '<type 'basestring'>' or '<class 'sqlalchemy.sql.elements.ClauseElement'>' or '<class 'sqlalchemy.sql.elements.TextClause'>', got '<type 'NoneType'>'

I suppose this has been introduced in issue #338. Following the example from that issue, the following doesn't work:

Revision 1:

def upgrade():
    op.create_table(
      'test',
      sa.Column('integer', sa.Integer, nullable=False, primary_key=True),
      sa.Column('string', sa.Text, nullable=False, server_default='default'),
    )

Revision 2:

def upgrade():
    with op.batch_alter_table('test') as batch_op:
        batch_op.alter_column('string', server_default=None)
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Mar 16, 2016

Michael Bayer (@zzzeek) wrote:

  • changelog for #361, fixes #361
  • rename test

11ad2a8

@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Mar 16, 2016

Changes by Michael Bayer (@zzzeek):

  • changed status to closed
@sqlalchemy-bot
Copy link
Author

@sqlalchemy-bot sqlalchemy-bot commented Mar 16, 2016

Michael Bayer (@zzzeek) wrote:

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.