C3 AI Documentation Home

MySQL Node

Load data from MySQL into Visual Notebooks.

Prerequisites

Follow the steps below to add credentials for MySQL. You must have a valid MySQL URL, username, and password.

  1. Drag a MySQL node onto the Visual Notebooks workspace
  2. Select the gear icon beside the Credential field Adding MySQL credentials - step 1
  3. Select the plus sign in the upper right corner Adding MySQL credentials - step 2
  4. Enter a name for the credential
  5. Enter the URL that you use to log into the MySQL web interface
  6. Enter the username and password you use to access MySQL Adding MySQL credentials - step 3

Configuration

FieldDescription
Name OptionalA user-specified node name displayed in the canvas
Credential RequiredThe information needed to access MySQL data Select a saved credential from the dropdown menu. Select the gear icon to add a new credential or delete existing credentials.
Database RequiredThe name of the desired MySQL database Select the database from the auto-populated dropdown menu.
Select Table or Define Query RequiredThe data to upload Select the table you want to upload from the auto-populated dropdown menu or enter a SQL query that returns the desired data.
Filter by Value OptionalConfigure filters to be applied to data Use the dropdown fields to filter results. Filter options include is null, is not null, is equal, is not equal, begins with, ends with, in between, is less than, is less than or equal to, is greater than, and is greater than or equal to. Filters can be applied on any column datatype. Add additional filters to create "And" conditional logic treatment.

Node Inputs/Outputs

InputNone
OutputVisual Notebooks returns a table, called a dataframe, that contains all uploaded data. Columns are labeled and include a symbol that specifies the data type of that column.

Example dataframe output

Figure 1: Example dataframe output

Different ways to create dataframes

Learn how to create dataframes using C3 Visual Notebooks.

Create a dataframe from selected data

  1. Select the MySQL database and table that contains the desired data.
  2. Select Run to create a dataframe.

MySQL table configuration

Figure 2: Example MySQL configuration

Example dataframe created from a MySQL table

Figure 3: Example dataframe created from a MySQL table

Create a dataframe from queried data

  1. Select a MySQL database.
  2. Write a query that returns the desired data. In the example below, the query returns all columns for the first five rows of the "porosity" table.
  3. Select Run to create a dataframe.

MySQL query configuration

Figure 4: Example MySQL configuration using a query

Example dataframe created from a MySQL query

Figure 5: Example dataframe created from a MySQL query

Create a dataframe from filtered data

  1. Select the MySQL credential and table ("porosity" in this example) that contains the desired data.
  2. Add a filter using the Filter by Value optional input. The input allows users to easily and visually configure ways to filter--for example by selecting a string column and only selecting rows that begin with a certain letter or selecting a numeric column and only returning results where the value is greater than a user specified input. In this example, a filter for rows where Porosity is greater than 78.2 is selected.
  3. Select Run to create a dataframe.

MySQL filter configuration

Figure 6: Example MySQL configuration using a filter

Example dataframe filtered by value

Figure 7: Example dataframe created using a filter

Was this page helpful?