Chat message history that stores history in Spanner.
Properties
messages
Retrieve the messages from Cloud Spanner
Methods
_verify_schema
_verify_schema()-> None
Verify table exists with required schema for SpannerChatMessageHistory class.
Use helper method MSSQLEngine.create_chat_history_table(...) to create
table with valid schema.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Class SpannerChatMessageHistory (0.9.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.9.0 (latest)](/python/docs/reference/langchain-google-spanner/latest/langchain_google_spanner.chat_message_history.SpannerChatMessageHistory)\n- [0.8.2](/python/docs/reference/langchain-google-spanner/0.8.2/langchain_google_spanner.chat_message_history.SpannerChatMessageHistory)\n- [0.7.0](/python/docs/reference/langchain-google-spanner/0.7.0/langchain_google_spanner.chat_message_history.SpannerChatMessageHistory)\n- [0.6.0](/python/docs/reference/langchain-google-spanner/0.6.0/langchain_google_spanner.chat_message_history.SpannerChatMessageHistory)\n- [0.5.0](/python/docs/reference/langchain-google-spanner/0.5.0/langchain_google_spanner.chat_message_history.SpannerChatMessageHistory)\n- [0.4.1](/python/docs/reference/langchain-google-spanner/0.4.1/langchain_google_spanner.chat_message_history.SpannerChatMessageHistory)\n- [0.3.0](/python/docs/reference/langchain-google-spanner/0.3.0/langchain_google_spanner.chat_message_history.SpannerChatMessageHistory) \n\n SpannerChatMessageHistory(\n instance_id: str,\n database_id: str,\n session_id: str,\n table_name: str,\n client: typing.Optional[google.cloud.spanner_v1.client.Client] = None,\n )\n\nChat message history that stores history in Spanner.\n\nProperties\n----------\n\n### messages\n\nRetrieve the messages from Cloud Spanner\n\nMethods\n-------\n\n### _verify_schema\n\n _verify_schema() -\u003e None\n\nVerify table exists with required schema for SpannerChatMessageHistory class.\nUse helper method MSSQLEngine.create_chat_history_table(...) to create\ntable with valid schema.\n\n### add_message\n\n add_message(message: langchain_core.messages.base.BaseMessage) -\u003e None\n\nAppend the message to the record in Cloud Spanner\n\n### clear\n\n clear() -\u003e None\n\nClear session memory from Cloud Spanner\n\n### create_chat_history_table\n\n create_chat_history_table(\n instance_id: str,\n database_id: str,\n table_name: str,\n client: typing.Optional[google.cloud.spanner_v1.client.Client] = None,\n ) -\u003e None\n\nCreate a chat history table in a Cloud Spanner database."]]