sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'constraint'. (102) (SQLExecDirectW)")
[SQL: declare @const_name varchar(256)
select @const_name = [name] from sys.default_constraints
where parent_object_id = object_id('Client')
and col_name(parent_object_id, parent_column_id) = 'client_id'
exec('alter table [Client] drop constraint ' + @const_name)]
(Background on this error at: http://sqlalche.me/e/f405)
The problem is that schema 'dm' is not passed to statement and therefore constraint is not found. The following statement is correct and drops the constraint.
declare @const_name varchar(256)
select @const_name = [name] from sys.default_constraints
where parent_object_id = object_id('dm.Client')
and col_name(parent_object_id, parent_column_id) = 'client_id'
exec('alter table [dm].[Client] drop constraint ' + @const_name)
I'm not sure if this is an issue with Alembic or SQL Alchemy.
The text was updated successfully, but these errors were encountered:
Hello, I'm having problem with dropping default constraint using alter_column operation.
Here is my setup:
I have the following table in my database
Suppose I have inserted few rows to table dm.Client
Now running the following upgrade fails
Error:
The problem is that schema 'dm' is not passed to statement and therefore constraint is not found. The following statement is correct and drops the constraint.
I'm not sure if this is an issue with Alembic or SQL Alchemy.
The text was updated successfully, but these errors were encountered: