Fixed regression caused by :ticket:`513`, where the logic to consume
``mssql_include`` was not correctly interpreting the case where the flag
was not present, breaking the ``op.create_index`` directive for SQL Server
as a whole.
Change-Id: I4c3a9d1f12017b62a7affa3863bba6e2bead67cf
Fixes: #516
name=name)
def create_index(self, index):
- mssql_include = index.kwargs.get('mssql_include', ())
+ # this likely defaults to None if not present, so get()
+ # should normally not return the default value. being
+ # defensive in any case
+ mssql_include = index.kwargs.get('mssql_include', None) or ()
for col in mssql_include:
if col not in index.table.c:
index.table.append_column(Column(col, sqltypes.NullType))
--- /dev/null
+.. change::
+ :tags: bug, mssql
+ :tickets: 516
+
+ Fixed regression caused by :ticket:`513`, where the logic to consume
+ ``mssql_include`` was not correctly interpreting the case where the flag
+ was not present, breaking the ``op.create_index`` directive for SQL Server
+ as a whole.
context.assert_contains(
"CREATE INDEX ix_mytable_a_b ON mytable "
"(col_a, col_b) INCLUDE (col_c)")
+
+ def test_create_index_mssql_include_is_none(self):
+ context = op_fixture('mssql')
+ op.create_index(
+ op.f('ix_mytable_a_b'), 'mytable', ['col_a', 'col_b'],
+ unique=False)
+ context.assert_contains(
+ "CREATE INDEX ix_mytable_a_b ON mytable "
+ "(col_a, col_b)")