Chalk supports MySQL as a SQL source. You can configure the MySQL-specific options using the MySQLSource init args, or configure the source through your dashboard, and reference the source in your code.


​
Adding MySQL

By navigating to Integrations > Add a data source and selecting MySQL, you’ll find a form where you can input information about your MySQL integration. Note that the data source must be accessible by the IAM Role defined in your cluster deployment.


​
Integrations Setup

After configuring your MySQL integration in the dashboard, define your data sources in Python:

from chalk.sql import MySQLSource

risk = MySQLSource(name="RISK")
marketing = MySQLSource(name="MARKETING")

Then reference them in SQL file resolvers using the name parameter. For example, to query from the RISK source:

-- type: online
-- resolves: User
-- source: RISK
SELECT id, credit_score FROM users

And to query from the MARKETING source:

-- type: online
-- resolves: User
-- source: MARKETING
SELECT id, email, campaign_status FROM users
Named integrations inject environment variables with the standard names prefixed by the integration name. For example, if your integration is called RISK, then the variable MYSQL_HOST will be injected as RISK_MYSQL_HOST.