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

drop_column(mssql_drop_check=True) doesn't quote names properly when generating 'drop constraint' SQL #186

Closed
sqlalchemy-bot opened this issue Mar 12, 2014 · 2 comments
Labels
bug Something isn't working

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Marek Baczyński (@imbaczek)

DB: SQL Server 2008R2

SQLAlchemy==0.9.3

alembic==0.6.4dev

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('table', sa.Column('col3', sa.Boolean(name='ck_col3'), nullable=True))
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('table', 'col3', mssql_drop_check=True)
    ### end Alembic commands ###

when downgrading, alembic emits the following SQL

declare @const_name varchar(256)
select @const_name = [name] from sys.check_constraints
where parent_object_id = object_id('table')
and col_name(parent_object_id, parent_column_id) = 'col3'
-- expected
exec('alter table [table] drop constraint [' + @const_name + ']')
-- actually emitted
exec('alter table table drop constraint ' + @const_name)
@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

efecc6c

@sqlalchemy-bot
Copy link
Author

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
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant