Guide
A MySQL data dictionary from your schema
A MySQL data dictionary lists each table and view, and each column on it: the database, the name, the data type, whether the column allows null, keys the account can see, and the comment stored on the column. It describes structure. It does not contain the rows stored in those columns.
DictionaryLeap does not connect to MySQL. Run the SELECT below, save the result as a CSV with the header row, and upload that file. Or upload a mysqldump --no-data script. The upload reads table_name, column_name, and data_type. table_schema, is_nullable, constraint_type, and the referenced table and column are used when they are present. A comment or column_comment value is stored on the column when that header is present. A COMMENT clause inside CREATE TABLE is not copied.
The free preview shows the first 25 columns and the first glossary domain. The Dataset Pack is $49 for one table of up to 200 columns, with a flat glossary plus one domain of the hierarchy, and a glossary CSV and SKOS for that domain. The Database Pack is $249 for up to 50 tables and 2,000 columns, with the full glossary and taxonomy hierarchy, all parent and child checks, an Excel glossary sheet, a glossary CSV, and SKOS. Each pack is a one-time price for that upload. It is not a subscription, and nothing renews.
What the dictionary covers
Database, table or view, and column name. The MySQL 8.0 page for INFORMATION_SCHEMA.COLUMNS says that table provides information about columns in tables. The information schema introduction says a user sees only rows for objects they have some privilege on. This query leaves out the schemas mysql, information_schema, performance_schema, and sys. It does not filter table type, so view columns are included when that table returns them.
Data type. The COLUMNS page says DATA_TYPE is the type name only, and COLUMN_TYPE contains the type name and possibly other information such as the precision or length. This query uses COLUMN_TYPE. On a local MySQL 8.0.46 server, the same SELECT without the comment column returned varchar(255) from COLUMN_TYPE.
is_nullable, YES or NO. Primary key and foreign key, when the account can see them. A column that is both is labeled PRIMARY KEY, FOREIGN KEY, and the referenced table and column are filled. If a column has more than one foreign key, one referenced pair is kept, chosen by constraint name. COLUMN_KEY is not selected. That page says the value is PRI, UNI, or MUL for an index, and a column shows only the highest of those. It does not name a foreign key target.
The column comment from COLUMN_COMMENT. The COLUMNS page says that is any comment included in the column definition. The query aliases it as comment, which is the header the upload stores. An empty comment means none was set. The same SELECT without this column was run on MySQL 8.0.46. The comment column itself was not part of that run.
What the CSV should contain
Use these header names. Letter case does not matter. A catalog file needs table_name, column_name, and data_type (or udt_name). The other columns are optional.
| Column | Required | What it is |
|---|---|---|
table_schema | No | Database name. Keeps two tables with the same name apart. |
table_name | Yes | Table or view name. |
column_name | Yes | Column name. |
data_type | Yes | COLUMN_TYPE, so length or precision is included when MySQL stores it there. |
is_nullable | No | YES or NO. |
constraint_type | No | PRIMARY KEY, FOREIGN KEY, or PRIMARY KEY, FOREIGN KEY. |
referenced_table_name | No | Table a foreign key points at. |
referenced_column_name | No | Column a foreign key points at. |
comment | No | COLUMN_COMMENT from the column definition. column_comment is also accepted as the header. |
How to do it
- Choose the database. Connect to MySQL. Add AND c.TABLE_SCHEMA = 'your_database' to the SELECT when you want one database. For mysqldump, pass that database name.
- Export the structure. Run the SELECT, or run mysqldump --no-data. The SELECT reads information_schema. The dump writes no table contents. Neither one is a copy of the rows.
- Save the file. Save the SELECT result as a CSV with the header row. Save the dump as a .sql file.
- Start the preview. Upload the file on the build page. Leave sample values off. DictionaryLeap does not connect to MySQL.
Read-only SQL
Run one query. Save the result as a CSV with the header row. Do not include a dump of table rows.
information_schema.COLUMNS
This statement was checked against the MySQL 8.0 page for INFORMATION_SCHEMA.COLUMNS. The same SELECT, without COLUMN_COMMENT, was run on a local MySQL 8.0.46 server against the same kind of schema used for the PostgreSQL check. It was not run on a production database. The result used the column names the upload accepts, including varchar(255) from COLUMN_TYPE. ROW_NUMBER() needs MySQL 8.0 or later.
The statement is a single SELECT. It does not insert, update, or delete, and it does not read rows from your tables. Add AND c.TABLE_SCHEMA = 'your_database' when you want one database. The account must be allowed to see the tables.
COLUMN_COMMENT is a column of information_schema.COLUMNS. This query adds it as comment. That extra column was not part of the earlier run. The upload stores a comment or column_comment cell. It does not store a description cell.
CSV query
SELECT
c.TABLE_SCHEMA AS table_schema,
c.TABLE_NAME AS table_name,
c.COLUMN_NAME AS column_name,
c.COLUMN_TYPE AS data_type,
c.IS_NULLABLE AS is_nullable,
CASE
WHEN pk.COLUMN_NAME IS NOT NULL AND fk.COLUMN_NAME IS NOT NULL THEN 'PRIMARY KEY, FOREIGN KEY'
WHEN pk.COLUMN_NAME IS NOT NULL THEN 'PRIMARY KEY'
WHEN fk.COLUMN_NAME IS NOT NULL THEN 'FOREIGN KEY'
ELSE NULL
END AS constraint_type,
fk.referenced_table_name,
fk.referenced_column_name,
c.COLUMN_COMMENT AS comment
FROM information_schema.COLUMNS AS c
LEFT JOIN (
SELECT DISTINCT
kcu.TABLE_SCHEMA,
kcu.TABLE_NAME,
kcu.COLUMN_NAME
FROM information_schema.TABLE_CONSTRAINTS AS tc
JOIN information_schema.KEY_COLUMN_USAGE AS kcu
ON kcu.CONSTRAINT_SCHEMA = tc.CONSTRAINT_SCHEMA
AND kcu.CONSTRAINT_NAME = tc.CONSTRAINT_NAME
AND kcu.TABLE_SCHEMA = tc.TABLE_SCHEMA
AND kcu.TABLE_NAME = tc.TABLE_NAME
WHERE tc.CONSTRAINT_TYPE = 'PRIMARY KEY'
) AS pk
ON pk.TABLE_SCHEMA = c.TABLE_SCHEMA
AND pk.TABLE_NAME = c.TABLE_NAME
AND pk.COLUMN_NAME = c.COLUMN_NAME
LEFT JOIN (
SELECT
ranked.TABLE_SCHEMA,
ranked.TABLE_NAME,
ranked.COLUMN_NAME,
ranked.REFERENCED_TABLE_NAME AS referenced_table_name,
ranked.REFERENCED_COLUMN_NAME AS referenced_column_name
FROM (
SELECT
kcu.TABLE_SCHEMA,
kcu.TABLE_NAME,
kcu.COLUMN_NAME,
kcu.REFERENCED_TABLE_NAME,
kcu.REFERENCED_COLUMN_NAME,
ROW_NUMBER() OVER (
PARTITION BY kcu.TABLE_SCHEMA, kcu.TABLE_NAME, kcu.COLUMN_NAME
ORDER BY kcu.CONSTRAINT_NAME
) AS rn
FROM information_schema.KEY_COLUMN_USAGE AS kcu
WHERE kcu.REFERENCED_TABLE_NAME IS NOT NULL
) AS ranked
WHERE ranked.rn = 1
) AS fk
ON fk.TABLE_SCHEMA = c.TABLE_SCHEMA
AND fk.TABLE_NAME = c.TABLE_NAME
AND fk.COLUMN_NAME = c.COLUMN_NAME
WHERE c.TABLE_SCHEMA NOT IN ('mysql', 'information_schema', 'performance_schema', 'sys')
ORDER BY c.TABLE_SCHEMA, c.TABLE_NAME, c.ORDINAL_POSITION;Save the result as a CSV with the header row. If a column has more than one foreign key, the query keeps one referenced pair, chosen by constraint name.
mysqldump --no-data
mysqldump --no-data writes no table row information. The MySQL 8.0 mysqldump page says this option does not dump table contents, and that it is useful when you want the CREATE TABLE statement. The command below was run on the local MySQL 8.0.46 server. It was not run on a production database.
On that run, the dump put PRIMARY KEY and FOREIGN KEY inside CREATE TABLE, and the upload recorded those keys. The dump also contains DROP statements and session settings. The upload reads CREATE TABLE statements and ignores the rest. --user and --host are documented connection options. They were not needed for the local socket used here.
A COMMENT clause on a column stays in the script. The upload does not copy that clause into the dictionary. Use the CSV when you want the comment stored. The upload does not read a CREATE VIEW statement.
Structure-only dump
mysqldump --no-data --user=USER --host=HOST DBNAMESave the output as a .sql file and upload it. USER, HOST, and DBNAME are placeholders. Replace them. --no-data writes no table contents.
The schema export guide has the MySQL query for keys. That query does not select COLUMN_COMMENT. Upload this CSV when you want the comment stored. Upload a mysqldump --no-data script when you want the CREATE TABLE statements. The script path does not copy a COMMENT clause.
Sensitivity flags and the glossary
DictionaryLeap flags potential sensitivity from the column name. A name such as email, phone, or a government identifier can be tagged. The tag is potential. It is not legal advice, and it does not mean the column was inspected for personal data. The CSV and the dump have no row values, so the file has no sample of what the column stores.
Healthcare, Financial services, and Retail are optional industry presets on the upload form. A preset adds terms and sensitivity rules when column names match. Any other choice uses the General preset. The preset does not change the price.
The draft includes a business glossary and taxonomy: domains, subject areas, and terms. Definitions are drafts for a data owner to confirm. When the column name does not support a meaning, DictionaryLeap withholds it and lists a question for a data owner, instead of stating it as fact. Owner and steward fields are placeholders so a person can assign them. The free preview shows the first glossary domain. The Dataset Pack includes a flat glossary plus one domain of the hierarchy, a glossary CSV, and SKOS for that domain. The Database Pack includes the full glossary and taxonomy hierarchy, all parent and child checks, an Excel glossary sheet, a glossary CSV, and SKOS.
A comment or column_comment value is stored on the column. The draft can quote it as a source comment when the text is at least 8 characters. Longer text is shortened to 140 characters. An empty comment is fine. Names and types are enough. That applies to the CSV. The script upload does not copy a COMMENT clause from CREATE TABLE.
Questions about a file or a charge: contact@logicalleap.io.
FAQ
Start the free preview
The free preview shows the first 25 columns and the first glossary domain. The Dataset Pack is $49 for one table of up to 200 columns, with a flat glossary plus one domain of the hierarchy, and a glossary CSV and SKOS for that domain. The Database Pack is $249 for up to 50 tables and 2,000 columns, with the full glossary and taxonomy hierarchy, all parent and child checks, an Excel glossary sheet, a glossary CSV, and SKOS. Each pack is a one-time price for that upload. It is not a subscription, and nothing renews.
Start the free preview