SQL Alchemy - Leverage __table_args__ to hold information about "skip migration" flag

hi y’all!

In SQL Alchemy: is it possible to leverage table_args in a class-based model to hold custom information and later on recover that when dealing with a Table class instance?

Example:

class MyTableModel(Base):
    __table_args__ = {"info": {"skip_migration": True}}

and then on the alembic/env.py we would use it in a custom include_object function:

def include_object(object, name, type_, reflected, compare_to):
    """
    Exclude tables from autogeneration.
    """
    # List of tables to skip
    skipped_tables = ("spatial_ref_sys", "another_table_to_skip")

    # if type_ == "table" and name in skipped_tables:
    #     return False

    if type_ == "table":
        # sqlalchemy.sql.schema.Table
        if object.info.get("skip_migrations"):
            print(f"Skipping table: {object.name}")
            return False

    return True

As of now the object.info is returning empty.

I know I can go a simpler route of checking a list of actual table names, but I want to try this approach first. Seems little bit more sophisticated

Thank you fo reading :smiley: