# Buggy code
def visit_create_index(self, create, include_schema=False):
    index = create.element
    self._verify_index_table(index)
    preparer = self.preparer
    text = "CREATE "
    if index.unique:
        text += "UNIQUE "

    # handle clustering option
    clustered = index.dialect_options["mssql"]["clustered"]
    if clustered is not None:
        if clustered:
            text += "CLUSTERED "
        else:
            text += "NONCLUSTERED "

    text += "INDEX %s ON %s (%s)" % (
        self._prepared_index_name(index, include_schema=include_schema),
        preparer.format_table(index.table),
        ", ".join(
            self.sql_compiler.process(expr, include_table=False, literal_binds=True)
            for expr in index.expressions
        ),
    )

    whereclause = index.dialect_options["mssql"]["where"]

    if whereclause is not None:
        where_compiled = self.sql_compiler.process(
            whereclause, include_table=False, literal_binds=True
        )
        text += " WHERE " + where_compiled

    # handle other included columns
    if index.dialect_options["mssql"]["include"]:
        inclusions = [
            index.table.c[col] if isinstance(col, util.string_types) else col
            for col in index.dialect_options["mssql"]["include"]
        ]

        text += " INCLUDE (%s)" % ", ".join(
            [preparer.quote(c.name) for c in inclusions]
        )

    return text


# Traceback (pyodbc.ProgrammingError)
Traceback (most recent call last):
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\default.py", line 593, in do_execute
cursor.execute(statement, parameters)
pyodbc.ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '('. (102) (SQLExecDirectW)")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce.py", line 42, in <module>
setup()
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce.py", line 39, in setup
metadata.create_all(engine)
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\sql\schema.py", line 4553, in create_all
bind._run_visitor(
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\base.py", line 2095, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\base.py", line 1656, in _run_visitor
visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\sql\visitors.py", line 145, in traverse_single
return meth(obj, **kw)
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\sql\ddl.py", line 783, in visit_metadata
self.traverse_single(
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\sql\visitors.py", line 145, in traverse_single
return meth(obj, **kw)
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\sql\ddl.py", line 839, in visit_table
self.traverse_single(index)
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\sql\visitors.py", line 145, in traverse_single
return meth(obj, **kw)
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\sql\ddl.py", line 868, in visit_index
self.connection.execute(CreateIndex(index))
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\base.py", line 1011, in execute
return meth(self, multiparams, params)
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\sql\ddl.py", line 72, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\base.py", line 1068, in _execute_ddl
ret = self._execute_context(
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\base.py", line 1316, in _execute_context
self._handle_dbapi_exception(
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\base.py", line 1510, in _handle_dbapi_exception
util.raise_(
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\util\compat.py", line 182, in raise_
raise exception
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\base.py", line 1276, in _execute_context
self.dialect.do_execute(
File "C:\dev\sqlalchemy_reproduce\sqlalchemy_reproduce-EWF-LNSc\lib\site-packages\sqlalchemy\engine\default.py", line 593, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '('. (102) (SQLExecDirectW)")
[SQL: CREATE INDEX idx_name_adult ON person (name) WHERE age > 18 INCLUDE (age)]
(Background on this error at: http://sqlalche.me/e/13/f405)

# Fixed code
def visit_create_index(self, create, include_schema=False):
    index = create.element
    self._verify_index_table(index)
    preparer = self.preparer
    text = "CREATE "
    if index.unique:
        text += "UNIQUE "

    # handle clustering option
    clustered = index.dialect_options["mssql"]["clustered"]
    if clustered is not None:
        if clustered:
            text += "CLUSTERED "
        else:
            text += "NONCLUSTERED "

    text += "INDEX %s ON %s (%s)" % (
        self._prepared_index_name(index, include_schema=include_schema),
        preparer.format_table(index.table),
        ", ".join(
            self.sql_compiler.process(expr, include_table=False, literal_binds=True)
            for expr in index.expressions
        ),
    )

    # handle other included columns
    if index.dialect_options["mssql"]["include"]:
        inclusions = [
            index.table.c[col] if isinstance(col, util.string_types) else col
            for col in index.dialect_options["mssql"]["include"]
        ]

        text += " INCLUDE (%s)" % ", ".join(
            [preparer.quote(c.name) for c in inclusions]
        )

    whereclause = index.dialect_options["mssql"]["where"]

    if whereclause is not None:
        where_compiled = self.sql_compiler.process(
            whereclause, include_table=False, literal_binds=True
        )
        text += " WHERE " + where_compiled

    return text