def _filter_metadata_for_connection(target, connection, **kw):
    """Listener to control what indexes get created.

    Useful for skipping postgres-specific indexes on a sqlite for example.

    It's looking for info entry `engines` on an index
    (`Index(info=dict(engines=['postgresql']))`), an iterable of engine names.
    """
    engine = connection.engine.name
    default_engines = (engine,)
    tables = target if isinstance(target, sa.Table) else kw.get("tables", [])
    for table in tables:
        indexes = list(table.indexes)
        for idx in indexes:
            if engine not in idx.info.get("engines", default_engines):
                table.indexes.remove(idx)
def _filter_metadata_for_connection ( target , connection , ** kw ) : engine = connection . engine . name default_engines = ( engine , ) tables = target if isinstance ( target , sa . Table ) else kw . get ( "tables" , [ ] ) for table in tables : indexes = list ( table . indexes ) for idx in indexes : if engine not in idx . info . get ( "engines" , default_engines ) : table . indexes . remove ( idx )
Listener to control what indexes get created.

    Useful for skipping postgres-specific indexes on a sqlite for example.

    It's looking for info entry `engines` on an index
    (`Index(info=dict(engines=['postgresql']))`), an iterable of engine names.