MySQLStorage class.
Usage
Run MySQL
Install docker desktop and run MySQL on port 3306 using:mysql_storage_for_workflow.py
Params
Developer Resources
- View Cookbook
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
You are viewing v1 docs. For the latest documentation, visit docs.agno.com
MySQLStorage class.
docker run -d \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_DATABASE=agno \
-e MYSQL_USER=agno \
-e MYSQL_PASSWORD=agno \
-p 3306:3306 \
--name mysql \
mysql:8.0
from agno.storage.mysql import MySQLStorage
db_url = "mysql+pymysql://agno:agno@localhost:3306/agno"
# Create a storage backend using the MySQL database
storage = MySQLStorage(
# store sessions in the agno.workflows table
table_name="workflow_sessions",
# db_url: MySQL database URL
db_url=db_url,
)
# Add storage to the Workflow
workflow = Workflow(storage=storage)
| Parameter | Type | Default | Description |
|---|---|---|---|
table_name | str | - | Name of the table to be used. |
schema | Optional[str] | "ai" | Schema name, default is "ai". |
db_url | Optional[str] | None | Database URL, if provided. |
db_engine | Optional[Engine] | None | Database engine to be used. |
schema_version | int | 1 | Version of the schema, default is 1. |
auto_upgrade_schema | bool | False | If true, automatically upgrades the schema when necessary. |
Was this page helpful?