> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://apidocs.polytomic.com/2024-02-08/guides/configuring-your-connections/connections/mysql/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://apidocs.polytomic.com/_mcp/server.
# MySQL
Supports:
* ✅ Models
* ✅ Model sync destination
* ✅ Bulk sync source
* ✅ Bulk sync destination
## Connection
### Configuration
| Name | Type | Description | Required |
account |
string |
Username |
required |
change_detection |
boolean |
Use replication for bulk syncs |
optional |
dbname |
string |
Database (optional) |
optional |
hostname |
string |
Hostname |
required |
passwd |
string |
Password |
required |
port |
integer |
Port |
required |
ssh |
boolean |
Connect over SSH tunnel ↓ |
optional |
ssl |
boolean |
Use SSL |
optional |
#### `ssh`
When `ssh` is `true`:
| Name | Type | Description | Required |
ssh_host |
string |
SSH host |
required |
ssh_port |
integer |
SSH port |
required |
ssh_private_key |
string |
Private key |
required |
ssh_user |
string |
SSH user |
required |
```json
{
"name": "MySQL connection",
"type": "mysql",
"configuration": {
"account": "admin",
"change_detection": false,
"dbname": "mydb",
"hostname": "database.example.com",
"passwd": "password",
"port": 3306,
"ssh": true,
"ssh_host": "bastion.example.com",
"ssh_port": 22,
"ssh_private_key": "",
"ssh_user": "root",
"ssl": true
}
}
```
#### Example
```json
{
"name": "MySQL connection",
"type": "mysql",
"configuration": {
"account": "admin",
"change_detection": false,
"dbname": "mydb",
"hostname": "database.example.com",
"passwd": "password",
"port": 3306,
"ssh": false,
"ssl": true
}
}
```
## Model Sync
### Source
#### Configuration
| Name | Type | Description | Required |
query |
string |
|
optional |
table |
string |
Table |
optional |
view |
string |
View |
optional |
#### Example
```json
{
...
"configuration": {
"query": "SELECT * from users",
"table": "users",
"view": "active_users"
}
}
```
### Target
MySQL connections may be used as the destination in a model sync.
#### All targets
##### Configuration
| Name | Type | Description | Required |
created_column |
string |
'Created at' timestamp column |
optional |
preserve_table_on_resync |
boolean |
Preserve destination table when resyncing |
optional |
updated_column |
string |
'Updated at' timestamp column |
optional |
write_null_values |
boolean |
Copy null values
When enabled updates will set fields to NULL when the source value is null |
optional |
write_record_timestamps |
boolean |
Write row timestamp metadata |
optional |
##### Example
```json
{
...
"target": {
"configuration": {
"created_column": "",
"preserve_table_on_resync": false,
"updated_column": "",
"write_null_values": false,
"write_record_timestamps": false
}
}
}
```
### Target creation
MySQL connections may be used to create a new target for a model sync. The
following parameters are required to create a new target:
| NAME |
DESCRIPTION |
ENUM |
| name |
Table name |
false |
## Bulk Sync
### Source
MySQL connections may be used as a bulk sync source. No additional configuration options are required.
### Destination
#### Configuration
| Name | Type | Description | Required |
advanced |
object |
|
optional |
mirror_schemas |
boolean |
Mirror schemas |
optional |
schema |
string |
Output schema |
optional |
#### Example
```json
{
...
"destination_configuration": {
"advanced": {
"empty_strings_null": true,
"hard_deletes": false,
"initial_execution": "rebuild",
"table_prefix": "",
"truncate_existing": false
},
"mirror_schemas": false,
"schema": "schema"
}
}
```
## Type handling
### Destination types
| POLYTOMIC TYPE | MYSQL TYPE |
|-----------------------------|----------------------------|
| `array<>` | `JSON` |
| `bigint` | `BIGINT` |
| `boolean` | `BOOLEAN` |
| `date` | `DATE` |
| `datetime` | `DATETIME` |
| `decimal(precision, scale)` | `DECIMAL(precision,scale)` |
| `double` | `DOUBLE` |
| `int` | `INT` |
| `json` | `JSON` |
| `jsonarray` | `JSON` |
| `number` | `DECIMAL(65,30)` |
| `object{}` | `JSON` |
| `single` | `FLOAT` |
| `smallint` | `SMALLINT` |
| `string` | `LONGTEXT` |
| `time` | `TIME` |
### Source types
| MYSQL TYPE | POLYTOMIC TYPE |
|-----------------------------|-----------------------------|
| `BIGINT` | `bigint` |
| `BIT` | `number` |
| `BLOB` | `binary` |
| `BLOB` | `string` |
| `CHAR` | `string` |
| `DATE` | `date` |
| `DATETIME` | `datetime` |
| `DECIMAL(precision, scale)` | `decimal(precision, scale)` |
| `DOUBLE` | `double` |
| `ENUM` | `string` |
| `FLOAT` | `single` |
| `INT` | `int` |
| `MEDIUMBLOB` | `binary` |
| `MEDIUMINT` | `int` |
| `MEDIUMTEXT` | `string` |
| `NUMERIC(precision, scale)` | `decimal(precision, scale)` |
| `SMALLINT` | `smallint` |
| `TEXT` | `string` |
| `TIME` | `time` |
| `TIMESTAMP` | `datetime` |
| `TINYBLOB` | `binary` |
| `TINYINT` | `smallint` |
| `TINYTEXT` | `string` |
| `UNSIGNED BIGINT` | `bigint` |
| `UNSIGNED INT` | `int` |
| `UNSIGNED SMALLINT` | `smallint` |
| `UNSIGNED TINYINT` | `smallint` |
| `VARBINARY` | `binary` |
| `VARCHAR` | `string` |
| `YEAR` | `int` |