Dropping a constraint with spaces using `mssql_drop_foreign_key=True` will results in an error
Activity
sqla-tester commentedon Feb 23, 2023
CaselIT has proposed a fix for this issue in the main branch:
Escape sql server constriant names https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/4463
zzzeek commentedon Feb 24, 2023
can you explain the issue here? "dropping a ...." what? Can I see what SQL is being emitted that fails?
not sure if im following the SQL correctly but it's selecting a column called
name
fromsys.default_constraints
orsys.check_contraints
, that is[name]
is a quoted identifier, you wouldn't put QUOTENAME there, and it does not have spaces in it.zzzeek commentedon Feb 24, 2023
oh I see, QUOTENAME is running on the returned data, fine.
CaselIT commentedon Feb 24, 2023
Sorry, the issue is when dropping constraints with names that need escaping. I've filled the missing words on the issue description.
Also this is a failry limited use case, since it affects only the
mssql_drop_*
kw argsEscape sql server constriant names