langchain/memory/chat_message_histories/sql.py/create_message_model
def create_message_model(table_name, DynamicBase):  # type: ignore
    # Model decleared inside a function to have a dynamic table name
    class Message(DynamicBase):
        __tablename__ = table_name
        id = Column(Integer, primary_key=True)
        session_id = Column(Text)
        message = Column(Text)

    return Message