MySqlInsert

Execute a MySQL INSERT statement.

Added in version 1.0.0.

  • Friendly name: MySQL Insert

  • Step class: base_steps_syncpack.steps.MySqlInsert.MySqlInsert

  • Step version: 1.1.1

  • Required parameters: database, host, username, password, port

Parameters

Name

Type

Required

Default

Description

table

string

no

–

The database table name. Example: Users

database

string

yes

–

The database name. Example: database1

host

string

yes

–

The host of the database. Example: host1

username

string

yes

–

The database username. Example: db_user_name

password

string

yes

–

The database password. Example: db_user_password

insert_query

string (long)

no

–

A full INSERT statement. Overrides the ‘data’ parameter. Example: INSERT INTO table_name (column1, column2) VALUES (value1, value2);

data

json

no

–

The data to insert into the database table. Example: {'name': 'Fred Smith', 'address': '2900 Main Street'}

port

number

yes

7706

The port of the database. Example: 8008

Every step also accepts the platform parameters common to all steps – see Platform parameters.

Dependencies

  • Inherits from: MySqlInsert -> BaseStep -> Serializable

  • SyncPack modules: base_steps_syncpack.util.mysql_utils

  • External packages: ipaascommon, ipaascore

Behaviour

Connects through util.mysql_utils.util_connect_mysql (pymysql, DictCursor) and runs an INSERT, then commits.

The statement comes from one of two places:

  • insert_query — used verbatim, and must start with insert;

  • otherwise built from data (column to value) plus table.

One of insert_query or the data + table pair is required.

Outputs

None. The step does not call save_data_for_next_step. Downstream steps see whatever the previous step produced.

Example

{
  "host": "db.example.com",
  "port": 7706,
  "database": "master_events",
  "username": "svc_pf",
  "password": "${config.db_password}",
  "table": "sync_log",
  "data": {"device_id": 4021, "synced_at": "2026-08-25T12:00:00Z"}
}

Notes

  • port is marked required with a default of 7706 — the SL1 MySQL port, not MySQL’s usual 3306.

  • insert_query overrides data entirely; setting both silently ignores data.

  • The leading-insert check is a literal string test, so a statement beginning with a comment or whitespace-then-keyword will be rejected.

API

class base_steps_syncpack.steps.MySqlInsert.MySqlInsert

Bases: BaseStep

execute()

All logic main logic for executing the step happens here

Returns:

get_connection(host, username, password, database, port)