Describe the bug
run_name_filters makes an assumption which breaks extending with different types of entity.
https://github.com/sqlalchemy/alembic/blob/master/alembic/autogenerate/api.py#L317
if "schema_name" in parent_names:
if type_ == "table":
table_name = name
else:
table_name = parent_names["table_name"]
This code appears to assume that if a target object has a schema as a parent, but is not a table, it must also have a table as a parent. This is true of columns, indexes, contraints and so on. However when extending Alembic, for example to implement support for replacable entities such as Views, the assumption doesn't hold true.
In the alembic_utils project, this necessitates a work around setting a dummy "table_name" to avoid a KeyError. https://github.com/olirice/alembic_utils/blob/master/src/alembic_utils/replaceable_entity.py#L378
Expected behavior
run_name_filters can accommodate target objects which are not tables but do not have tables as parents.
To Reproduce
I'm afraid I don't have a minimal example but running alembic_utils without the work around linked to above causes a KeyError when parent_names["table_name"] is accessed.