Feature Engine
Integrate with MySQL data sources.
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.
On the dashboard, you can plug in the configuration for your MySQL database:
Add a MySQL integration.
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 usersAnd to query from the MARKETING source:
-- type: online
-- resolves: User
-- source: MARKETING
SELECT id, email, campaign_status FROM usersNamed 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.