You can define the tables to be excluded in app1 in you app1's alembic.ini file, example is below:
[alembic:exclude]
tables = table1,table2
Then in you env.py file, you can in include_object function.
include_object is a callable function which is given the chance to return True or False for any object, indicating if the given object should be considered in the autogenerate sweep.
https://alembic.sqlalchemy.org/en/latest/api/runtime.html?highlight=include_object#alembic.runtime.environment.EnvironmentContext.configure.params.include_object
Code in env.py file
exclude_tables = config.get_section('alembic:exclude').get('tables', '').split(',')
def include_object(object, name, type_, reflected, compare_to):
if type_ == "table" and name in exclude_tables:
return False
else:
return True
exclude_tables will contain the list of all the tables, that you have defined in your alembic.ini file
Then include this include_object function in your context.configure function as below:
context.configure(
# ...
include_object = include_object
)