MySQL
Run queries, insert, update, and delete rows in a MySQL database.
On this page
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.
| Field | Type | Description |
|---|---|---|
hostrequired | text | Database server hostname or IP address |
portrequired | text | Database server port (default 3306) |
userrequired | text | Database username |
passwordrequired | secret | Database password |
databaserequired | text | Database 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.
// 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);
});{
"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"
}
}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
| Input | Type | Description |
|---|---|---|
timezoneoptional | text | Timezone for the MySQL server to use |
tablerequired | id (picked from your account) | Table |
search_columnrequired | text | Search Column |
search_valuerequired | text | Search Value |
insert_row
Insert Row. Inserts a new row into a table
| Input | Type | Description |
|---|---|---|
timezoneoptional | text | Timezone for the MySQL server to use |
tablerequired | id (picked from your account) | Table |
valuesrequired | object | Values |
update_row
Update Row. Updates one or more rows in a table
| Input | Type | Description |
|---|---|---|
timezoneoptional | text | Timezone for the MySQL server to use |
tablerequired | id (picked from your account) | Table |
valuesrequired | object | Values |
search_columnrequired | text | Search Column |
search_valuerequired | text | Search Value |
execute_query
Execute Query. Executes a query on the mysql database and returns the results
| Input | Type | Description |
|---|---|---|
timezoneoptional | text | Timezone for the MySQL server to use |
queryrequired | text | The query string to execute, use ? for arguments to avoid SQL injection. |
argsoptional | array | Arguments 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
| Input | Type | Description |
|---|---|---|
timezoneoptional | text | Timezone for the MySQL server to use |
tablerequired | id (picked from your account) | Table |
conditionrequired | text | SQL condition, can also include logic operators, etc. |
argsoptional | array | Arguments can be used using ? in the condition |
columnsoptional | array | Specify 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