# Class MSSQLChatMessageHistory (0.3.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [0.3.0 (latest)](https://docs.cloud.google.com/python/docs/reference/langchain-google-cloud-sql-mssql/latest/langchain_google_cloud_sql_mssql.chat_message_history.MSSQLChatMessageHistory)
- [0.2.1](https://docs.cloud.google.com/python/docs/reference/langchain-google-cloud-sql-mssql/0.2.1/langchain_google_cloud_sql_mssql.chat_message_history.MSSQLChatMessageHistory)

    MSSQLChatMessageHistory(
        engine: langchain_google_cloud_sql_mssql.engine.MSSQLEngine,
        session_id: str,
        table_name: str,
    )

Chat message history stored in a Cloud SQL MSSQL database.

| ## Parameters ||
|---|---|
| **Name** | **Description** |
| `engine` | `MSSQLEngine` SQLAlchemy connection pool engine for managing connections to Cloud SQL for SQL Server. |
| `session_id` | `str` Arbitrary key that is used to store the messages of a single chat session. |
| `table_name` | `str` The name of the table to use for storing/retrieving the chat message history. |

## Properties

### messages

Retrieve the messages from Cloud SQL

## Methods

### _verify_schema

    _verify_schema() -> None

Verify table exists with required schema for MSSQLChatMessageHistory class.

Use helper method MSSQLEngine.init_chat_history_table(...) to create
table with valid schema.

### add_message

    add_message(message: langchain_core.messages.base.BaseMessage) -> None

Append the message to the record in Cloud SQL

### clear

    clear() -> None

Clear session memory from Cloud SQL