dagster-mysql

raw JSON →
0.29.3 verified Fri May 01 auth: no python

A Dagster integration library for MySQL, providing a MySQLEventLogStorage and MySQLRunStorage for persisting Dagster event logs and run metadata in MySQL. Compatible with Dagster 1.13.x (library version 0.29.x). Released as part of the main Dagster monorepo on a weekly cadence.

pip install dagster-mysql
error ModuleNotFoundError: No module named 'mysql'
cause Missing mysql-connector-python dependency.
fix
Install mysql-connector-python: pip install mysql-connector-python
error OperationalError: (mysql.connector.errors.OperationalError) 1045 (28000): Access denied for user 'root'@'...'
cause Invalid MySQL credentials or host not allowed to connect.
fix
Verify MYSQL_USER, MYSQL_PASSWORD, and that the user has remote access permissions.
error ImportError: cannot import name 'MySQLEventLogStorage' from 'dagster_mysql'
cause Old versions of dagster-mysql (<0.28) exported from submodules; the preferred import path changed.
fix
Use from dagster_mysql import MySQLEventLogStorage. If using an older version, import from dagster_mysql.event_log.
gotcha MySQLEventLogStorage and MySQLRunStorage are not drop-in replacements for the default Postgres-based storages. They have different schema and may not support all features (e.g., certain query optimizations).
fix Review the Dagster documentation for MySQL storage limitations.
gotcha The MySQL storage backends use `mysql-connector-python` under the hood. If you encounter connection issues, ensure the MySQL server is reachable and the credentials are correct. The `from_local` method does not use environment variables by default; you must pass them explicitly.
fix Explicitly provide `mysql_host`, `mysql_port`, etc., either via code or environment.
deprecated As of Dagster 1.13, `MySQLScheduleStorage` has been deprecated in favor of using a centralized schedule storage via Dagster Cloud or the core Postgres storage. Direct MySQL schedule storage may be removed in future versions.
fix Migrate schedule storage to the default Dagster storage backend (Postgres).

Basic setup to connect MySQL event log and run storage. Requires a running MySQL server.

from dagster_mysql import MySQLEventLogStorage, MySQLRunStorage

# Example configuration dict for the MySQL storage backends
config = {
    "mysql_host": os.environ.get("MYSQL_HOST", "localhost"),
    "mysql_port": int(os.environ.get("MYSQL_PORT", "3306")),
    "mysql_user": os.environ.get("MYSQL_USER", "root"),
    "mysql_password": os.environ.get("MYSQL_PASSWORD", ""),
    "mysql_db_name": os.environ.get("MYSQL_DB_NAME", "dagster"),
}

# Create storage instances
event_log_storage = MySQLEventLogStorage.from_local(**config)
run_storage = MySQLRunStorage.from_local(**config)

# Verify connection (raises if cannot connect)
print("Connected to MySQL successfully.")