marmotdata/mysql
Discover databases and tables from MySQL instances
The MySQL plugin discovers databases and tables from MySQL instances. It captures column information, row counts, and foreign key relationships for lineage.
Tables and views are identified in their MRN by database.table, for example mrn://asset/table/mysql/shop.orders. Set zone to a short name such as prod-eu when you run two servers of the same kind, and it becomes part of every MRN. The name is one you choose, not a cloud availability zone.
Required Permissions
The user needs read access to the information schema:
CREATE USER 'marmot_reader'@'%' IDENTIFIED BY 'your-password';
GRANT SELECT ON your_database.* TO 'marmot_reader'@'%';
GRANT SELECT ON information_schema.* TO 'marmot_reader'@'%';
Querying
This plugin lets Marmot run read-only SQL against a MySQL source for data queries. Every statement runs inside a START TRANSACTION READ ONLY transaction that is always rolled back, over a connection whose DSN leaves multiStatements unset, so the server accepts at most one statement per call and that statement can neither write nor smuggle a second statement past the transaction. MySQL refuses most writes itself once inside that transaction, and also refuses FOR UPDATE, but it does not refuse SELECT ... INTO OUTFILE or INTO DUMPFILE, which write a file rather than a table, nor FOR SHARE or LOCK IN SHARE MODE, which still take a lock. The plugin refuses all of these itself before anything reaches the engine, as well as anything that is not a SELECT, WITH, TABLE, VALUES, SHOW or DESCRIBE style read, and any statement that reads or assigns a user variable (@name). A user variable lives on the connection's session for as long as it stays open, not just for the transaction that set it, so one caller's SELECT @leak := secret_col FROM secret could otherwise still answer a later, unrelated caller's SELECT @leak if the two happen to share a pooled connection; reading a system variable (@@name) is unaffected, since it carries no caller data. As a second, independent safeguard, the connection pool for data queries never keeps an idle connection open: MySQL has no statement that clears a session's user variables, so each call gets a connection that has either just been opened or was never used by anyone else.
The statement is planned with EXPLAIN FORMAT=JSON, read alongside the optimizer trace that planning it leaves behind. The trace, not EXPLAIN's own output, is what the plan is built from: once a statement or a view it reads through gives a table an alias, EXPLAIN FORMAT=JSON's table_name field reports that alias instead of the table's name, and an alias chosen to match another real table's name would otherwise make the plan name the wrong table. Each resolved table is mapped to the MRN discovery would give it, so a grant written against a catalogued asset binds on the query path too; a statement that calls a stored function, which can run a query of its own that reads tables the plan never sees, is marked incomplete and falls back to requiring a grant on the whole source, as does a SHOW or DESCRIBE statement, which EXPLAIN cannot plan at all.
None of this is a substitute for database-level permissions: the read-only transaction and the checks above stop a statement from writing or reaching outside the database, but the connecting user's own privileges are the real boundary on what it can read. Use a dedicated account with only SELECT for marmot_reader rather than relying on Marmot alone.
In the UI
Point and click, no config file needed.
- Open Runs and choose Create pipeline.
- Pick MySQL from the plugin list.
- Fill in the settings, set a schedule and save.
With the CLI
Save a YAML config, then run marmot ingest.
Not using plugins? Other ways to populate Marmot
Configuration
Fields marked Required must be set.
tagsList of textTags to apply to discovered assets
external_linksList of groupsExternal links to show on all assets
nameTextDisplay name for the link
iconTextIcon identifier for the link
urlTextURL to the external resource
filterGroup of settingsFilter discovered assets by name (regex)
includeList of textInclude patterns for resource names (regex)
excludeList of textExclude patterns for resource names (regex)
zoneTextTells this system apart from others of the same technology and becomes part of every asset's MRN
hostText RequiredMySQL server hostname or IP address
portNumberMySQL server port
userText RequiredUsername for authentication
passwordSecretPassword for authentication
databaseText RequiredDatabase name to connect to
tlsOne ofTLS configuration (false, true, skip-verify, preferred)
include_columnsYes or noWhether to include column information in table metadata
include_row_countsYes or noWhether to include approximate row counts
discover_foreign_keysYes or noWhether to discover foreign key relationships
Assets emitted
Metadata this plugin attaches to each discovered asset.
MySQL
MySQL-specific metadata fields
Column
MySQL column-specific metadata fields
Foreign Key
MySQL foreign key relationship fields