transfer_objects
Transfer database schema and data between PostgreSQL servers or databases with topological ordering. Supports dry-run to preview SQL changes.
Instructions
Transfer schema (DDL) and/or data from one configured server/database to another (same server, different DB, or fully remote). Builds on the introspection module for DDL extraction with topological ordering. Modes: include='ddl'|'data'|'both'. Behavior on existing target objects: if_exists='skip'|'replace'|'error'. dry_run=true emits the would-be SQL to output_file or returns inline (no target writes). Both endpoints must be configured servers (PG_NAME_*); ad-hoc connection strings are not accepted (security). Refuses if target's effective access mode is readonly. FK constraints between tables are emitted as ALTER TABLE statements appended after tables to handle inter-table dependency cycles.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from | Yes | Source endpoint. | |
| to | Yes | Target endpoint. | |
| objects | Yes | List of objects, or '*' for all objects in source schema. | |
| include | No | both | |
| if_exists | No | Behavior when a target object already exists. | error |
| data_strategy | No | insert_batches | |
| dry_run | No | Generate SQL without applying. Use with output_file. | |
| output_file | No | When dry_run is true, write generated SQL to this .sql path. |