sql.database.replicate ​
Replicate Postgres DDL + data from one SQL connection to another; verify row counts; optionally keep destination synced via watermark catch-up
Overview ​
| Property | Value |
|---|---|
| Workflow type | Linear |
| Library | App-sql |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | — |
source_cloud_connection_uuid | uuid | Yes | — | Source SQL connection (Postgres) |
destination_cloud_connection_uuid | uuid | Yes | — | Destination SQL connection (Postgres) |
include_schemas | list | No | — | Schemas to include (default: [public]) |
exclude_tables | list | No | — | Table names or schema.table to skip |
conflict_policy | string | No | — | fail_if_dest_not_empty (default) |
sync_enabled | boolean | No | — | After cutover verify, enter watermark sync loop |
watermark_column | string | No | — | Required when sync_enabled; typically updated_at (timestamptz) |
sync_interval_seconds | integer | No | — | Delay between sync polls (default 30) |
sync_batch_size | integer | No | — | Max rows per table per sync poll (default 1000) |
actor | string | No | — | — |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | No | — | — |
source_cloud_connection_uuid | uuid | No | — | — |
destination_cloud_connection_uuid | uuid | No | — | — |
verification_ok | boolean | No | — | — |
tables_data_done | list | No | — | — |
verification | list | No | — | — |
sync_enabled | boolean | No | — | — |
checkpoints | dict | No | — | — |
completed_at | string | No | — | — |
failure_reason | string | No | — | Engine-stamped human-readable failure reason |
failed_at_state | string | No | — | Engine-stamped state when the workflow failed |
failed_step | string | No | — | Engine-stamped step name (DAG path) |
failed_layer | integer | No | — | Engine-stamped layer index (DAG path) |
error | string | No | — | Engine-stamped exception message |
error_type | string | No | — | Engine-stamped exception class name |
failure_type | string | No | — | Engine-stamped failure category (atomic path) |
failed_action | string | No | — | Engine-stamped action method that raised (atomic path) |
failed_at | string | No | — | ISO timestamp when the fail action ran |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
initiated | Yes | No | — | validate | Inputs accepted |
applying_schema | No | No | — | — | Creating / preparing destination tables |
copying_data | No | No | — | — | Streaming table data source → destination |
planning | No | No | — | apply_schema | Introspecting source tables |
syncing | No | No | — | — | Watermark catch-up loop |
validating | No | No | — | plan | Probing source and destination connections |
verifying | No | No | — | after_verify | Comparing row counts |
completed | No | Yes | Yes | — | Cutover verified (and sync stopped if it was running) |
failed | No | Yes | No | — | Replication failed |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
initiated | validate | validating | — |
validating | plan | planning | — |
planning | apply_schema | applying_schema | — |
applying_schema | apply_schema | applying_schema | — |
applying_schema | begin_copy | copying_data | — |
copying_data | copy_data | copying_data | — |
copying_data | begin_verify | verifying | — |
verifying | after_verify | completed | — |
verifying | enter_sync | syncing | — |
syncing | poll_sync | syncing | — |
syncing | complete_sync | completed | — |
* (any state) | fail | failed | — |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "sql.database.replicate",
"initial_data": {
"organization_uuid": "value",
"source_cloud_connection_uuid": "value",
"destination_cloud_connection_uuid": "value"
}
}