MySQL

Run queries, insert, update, and delete rows in a MySQL database.

Data and storageCredentials form6 actionsAll integrations

On this page
  1. Connect
  2. Call it from a workflow
  3. Actions (6)
  4. delete_row
  5. insert_row
  6. update_row
  7. execute_query
  8. find_rows
  9. get_tables
  10. Details

Connect

Auth type: Credentials form (custom_auth). Pass the fields the provider needs (listed below) as the connection's credentials. They are sealed at rest.

FieldTypeDescription
hostrequiredtextDatabase server hostname or IP address
portrequiredtextDatabase server port (default 3306)
userrequiredtextDatabase username
passwordrequiredsecretDatabase password
databaserequiredtextDatabase name to connect to
  • From your agent: integrations {action: "connect", piece, credentials, env} stores the credentials for dev, prod or all. Answers name the fields, never the values.
  • Or set the integration's project secrets with the secrets tool (SLACK_BOT_TOKEN, DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN, TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN …): a call uses the connection, else those secrets. integrations {action: "catalog", piece} lists which ones work.
  • Try one action now with integrations {action: "call", piece, piece_action, input}. It really sends.

Call it from a workflow

step.ctx.integrations.invoke("mysql", action, input) resolves with the provider's answer and rejects when MySQL isn't connected or refuses. Wrap it in step.run so a retry sends once. See step.ctx. Its actions run through the integration runner, which the server's operator turns on: integrations {action: "catalog", piece: "mysql"} says whether yours can call it.

Workflow
// workflows/notify.ts: call MySQL when a booking is confirmed
import { on } from "@appbricx/workflows";

export const tellMysql = on.transition("booking", "status", "confirmed", async (_event, step) => {
  // Recorded once: a retry doesn't send it twice. Rejects when MySQL isn't connected.
  const output = await step.run("MySQL", () =>
    step.ctx.integrations.invoke("mysql", "delete_row", {
      "table": "<table>",
      "search_column": "<search column>",
      "search_value": "<search value>"
    }),
  );
  step.ctx.log("MySQL answered", output);
});
Try it from your agent
{
  "name": "integrations",
  "arguments": {
    "project_id": "<project-id>",
    "action": "call",
    "piece": "mysql",
    "piece_action": "delete_row",
    "input": {
      "table": "<table>",
      "search_column": "<search column>",
      "search_value": "<search value>"
    },
    "env": "dev"
  }
}
From another backend (connector proxy)
curl -X POST "$APP_ORIGIN/__appbricx/connector-proxy/mysql/delete_row" \
  -H "Authorization: Bearer $APP_KEY" \
  -H "content-type: application/json" \
  -d '{"props":{"table":"<table>","search_column":"<search column>","search_value":"<search value>"}}'

Actions

delete_row

Delete Row. Deletes one or more rows from a table

InputTypeDescription
timezoneoptionaltextTimezone for the MySQL server to use
tablerequiredid (picked from your account)Table
search_columnrequiredtextSearch Column
search_valuerequiredtextSearch Value

insert_row

Insert Row. Inserts a new row into a table

InputTypeDescription
timezoneoptionaltextTimezone for the MySQL server to use
tablerequiredid (picked from your account)Table
valuesrequiredobjectValues

update_row

Update Row. Updates one or more rows in a table

InputTypeDescription
timezoneoptionaltextTimezone for the MySQL server to use
tablerequiredid (picked from your account)Table
valuesrequiredobjectValues
search_columnrequiredtextSearch Column
search_valuerequiredtextSearch Value

execute_query

Execute Query. Executes a query on the mysql database and returns the results

InputTypeDescription
timezoneoptionaltextTimezone for the MySQL server to use
queryrequiredtextThe query string to execute, use ? for arguments to avoid SQL injection.
argsoptionalarrayArguments to use in the query, if any. Should be in the same order as the ? in the query string..

find_rows

Find Rows. Reads rows from a table

InputTypeDescription
timezoneoptionaltextTimezone for the MySQL server to use
tablerequiredid (picked from your account)Table
conditionrequiredtextSQL condition, can also include logic operators, etc.
argsoptionalarrayArguments can be used using ? in the condition
columnsoptionalarraySpecify the columns you want to select

get_tables

Get Tables. Returns a list of tables in the database

No input.

Details

Id
mysql
Category
Data and storage
Tags
database, sql, relational, open-source
Package
@activepieces/piece-mysql@0.2.3
Runs
Through the integration runner