[Sqlalchemy-tickets] Issue #3025: Table.create fails with checkfirst=True on already existing table
Brought to you by:
zzzeek
|
From: Brian P. <iss...@bi...> - 2014-04-16 13:55:31
|
New issue 3025: Table.create fails with checkfirst=True on already existing table when TABLE_SCHEMA is not 'dbo' https://bitbucket.org/zzzeek/sqlalchemy/issue/3025/tablecreate-fails-with-checkfirst-true-on Brian Pantano: I'm on SQL Server using sqlalchemy 0.9.2. It's hard to provide a repro steps without my particular db setup. Basically table.create will fail because "There is already an object named 'table' in the database". It's failing because checkfirst=true is executing this SQL: SELECT [COLUMNS_1].[TABLE_SCHEMA], [COLUMNS_1].[TABLE_NAME], [COLUMNS_1].[COLUMN_NAME], [COLUMNS_1].[IS_NULLABLE], [COLUMNS_1].[DATA_TYPE], [COLUMNS_1].[ORDINAL_POSITION], [COLUMNS_1].[CHARACTER_MAXIMUM_LENGTH], [COLUMNS_1].[NUMERIC_PRECISION], [COLUMNS_1].[NUMERIC_SCALE], [COLUMNS_1].[COLUMN_DEFAULT], [COLUMNS_1].[COLLATION_NAME] FROM [INFORMATION_SCHEMA].[COLUMNS] AS [COLUMNS_1] WHERE [COLUMNS_1].[TABLE_NAME] = CAST('table_name' AS NVARCHAR(max)) AND [COLUMNS_1].[TABLE_SCHEMA] = CAST('dbo' AS NVARCHAR(max)) is returning zero rows because the owner of the table isn't dbo, but my username. This breaks alembic because checkfirst is used on the alembic_version table. |