MySQL Table List
Overview
This Snap outputs a list of tables in a database. The Snap will connect to the database, read its metadata, and output a document for each table found in the database. The table names are output in a topological order so that tables with the fewest dependencies are output first. In other words, if table A has a foreign key reference to table B, then table B will be output before A. The ordering is intended to ease the process of replicating a group of tables from one database to another.
- This is a Read-type Snap.
Works in Ultra Tasks
Prerequisites
A valid account with SELECT privileges on the information_schema database or appropriate privileges to query table metadata.
Known issues
When MySQL execute Snaps (MySQL Execute and MySQL Multi Execute) are followed by MySQL non-execute Snaps, such as MySQL Insert, MySQL Merge, and so on, the following error is displayed when executed:
Table definition has changed, please retry transaction.
This happens due to a known issue in the MySQL Connector. For more information about this issue, see MySQL Bug #65378.
Snap views
| Type | Description | Examples of upstream and downstream Snaps |
|---|---|---|
| Input | Expected input: [None] | |
| Output | Expected output: Documents with the following fields:
|
|
| Learn more about Error handling. | ||
Replicating a Subset of Tables
The output of the Table List Snap can be directly used to replicate an entire database. However, if you are only interested in a subset of tables, you can use a Filter Snap to select the table names you are interested in as well as the tables that they reference. For example, given the following diamond-shaped table graph where A depends on B and C and they both depend on D:
A
/ \
B C
\ /
D
The TableList will output the following documents:
name=D; dependents=[A, B, C, D]
name=C; dependents=[A, C]
name=B; dependents=[A, B]
name=A; dependents=[A]
So, if you wanted to copy just table 'A' and its dependencies, you can add a Filter Snap with the following expression:
$.dependents.indexOf('A') != -1
The filter will then remove any extra tables that happen to be in the schema.
Snap settings
- Expression icon (
): Allows using pipeline parameters to set field values dynamically (if enabled). SnapLogic Expressions are not supported. If disabled, you can provide a static value.
- SnapGPT (
): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
- Suggestion icon (
): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
- Upload
: Uploads files. Learn more.
| Field/Field set | Description |
|---|---|
Label
String |
Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline. |
| Schema name
|
The database schema name. Selecting a schema filters the Table name list to show only those tables within the selected schema. The property is suggestable and will retrieve available database schemas during suggest values. Example: test Default value: [None] |
| Compute table graph
|
Computes the dependents among tables and returns each table with a list of tables it has foreign key references to. The ordering of outputted tables is from least dependent to most-dependent. Note that as turning on this option will significantly slow down the Snap, it should be left as off unless you need it. |
Snap execution
Dropdown list |
Choose one of the three modes in
which the Snap executes. Available options are:
|