09. Save chat to SQLite
SQL (SQLAlchemy)
Structured Query Language (SQL) Domain-specific language used for silver programming, designed for managing data in relational database management systems (RDBMS) or for stream processing in relational data stream management systems (RDSMS). It is especially useful for dealing with structured data, including the relationship between entities and variables.
SQLAlchemy Is an open source for Python programming languages distributed according to MIT licenses SQL Toolkit and object relationship mapper (ORM).# API KEY A configuration file for managing environment variables
from dotenv import load_dotenv
# API KEY Load information
load_dotenv()TrueUsage
from langchain_community.chat_message_histories import SQLChatMessageHistory
# SQLChatMessageHistory Create an object and set the session ID and database connection file.
chat_message_history = SQLChatMessageHistory(
session_id="sql_history", connection="sqlite:///sqlite.db"
)Apply to Chain
Last updated