def get_data_model(
    base: type[DeclarativeBase],
    index_name: str,
) -> Any:
    """
    This part create a dynamic sqlalchemy model with a new table.
    """
    class_name = f"Data{index_name}"  # dynamic class name

    class AbstractData(base):  # type: ignore
        __tablename__ = f"data_{index_name}"  # dynamic table name
        __abstract__ = True  # this line is necessary

        id: Mapped[int] = mapped_column(
            Integer(),
            primary_key=True,
            autoincrement=True,
            index=True,
        )  # Add primary key
        key: Mapped[str] = mapped_column(
            String(),
            nullable=False,
            index=True,
        )
        value: Mapped[str] = mapped_column(JSON())

    return type(
        class_name,
        (AbstractData,),
        {},
    )

    This part create a dynamic sqlalchemy model with a new table.
    
llama-index-integrations/storage/chat_store/llama-index-storage-chat-store-sqlite/llama_index/storage/chat_store/sqlite/base.py