Skip to main content
Copies an external PostgreSQL database into a Xata branch, once with start or continuously with stream, and can anonymize columns on the way in. config writes the anonymization rules the other two read. Every command below also takes -h, --help.

start

Snapshot a PostgreSQL database into a Xata branch Copies the source database into the branch once. The anonymization rules in .xata/clone.yaml are applied on the way in, and strict validation refuses to run until every table and column is covered by them.
string
.env or .yaml config file to use with pgstream if any
string
Log output format. One of console, json
trace | debug | info | warn | error | fatal | panic
default:"info"
Log level for pgstream
boolean
Disable ANSI color codes in console log output (ignored when —log-format=json)
boolean
Whether to produce CPU and memory profile files, as well as exposing a /debug/pprof endpoint on localhost:6060
string
File where the pg_dump output will be written
string
required
The source URL of the database to clone
string
Organization ID
string
Project ID
string
Branch ID or name
string
Database name on the branch
string
default:"*.*"
Tables to filter
strict | relaxed | prompt
default:"prompt"
Anonymization validation mode, strict implies that all tables and columns should be specified
string
Postgres role to use for the clone
boolean
default:"false"
Copy roles, owners, and privileges to the target
boolean
default:"false"
Temporarily tune the target branch for bulk loading, reverting the change when the clone stops. Raises max_wal_size on the branch and the maintenance settings on the index rebuild.
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.

config

Write the anonymization rules that clone start and stream apply Inspects the source database and writes .xata/clone.yaml, interactively or with AI, so the columns that carry personal data are transformed as they are copied.
string
required
The source URL of the database to clone
auto | prompt | web | ai
default:"prompt"
The assisting mode to help with the configuration generation
strict | relaxed | prompt
default:"prompt"
Anonymization validation mode, strict implies that all tables and columns should be specified
string
Organization ID
string
Project ID
string
Branch ID or name
string
Instructions for AI mode (e.g., which columns to anonymize, specific transformers to use)
gemini-2.5-flash | claude-sonnet-4-6 | claude-haiku-4-5-20251001
AI model, gemini-2.5-flash by default
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.

stream

Stream a PostgreSQL database into a Xata branch continuously Copies the tables --filter-tables selects first, then follows the source through logical replication, so the branch keeps up with it until the command is stopped.
string
.env or .yaml config file to use with pgstream if any
string
Log output format. One of console, json
trace | debug | info | warn | error | fatal | panic
default:"info"
Log level for pgstream
boolean
Disable ANSI color codes in console log output (ignored when —log-format=json)
boolean
Whether to expose a /debug/pprof endpoint on localhost:6060
string
File where the pg_dump output will be written if initial snapshot is enabled
string
required
The source URL of the database to stream from
string
Organization ID
string
Project ID
string
Branch ID or name
string
Database name on the branch
string
default:"*.*"
Tables to filter
strict | relaxed | prompt
default:"prompt"
Anonymization validation mode, strict implies that all tables and columns should be specified
string
Postgres role to use for streaming (it should have at least REPLICATION privilege)
boolean
default:"false"
Copy roles, owners, and privileges to the target
boolean
default:"false"
Skip DDL tracking during streaming. Useful for managed PostgreSQL services that do not support superuser access required for event triggers. Requires —replication-slot flag to be set with a pre-created replication slot on the source database.
string
Name of the replication slot on the source database. Overrides the default slot name
string
The profile to use
boolean
Print where each resolved value came from
boolean
Output in JSON format when the command supports it. Defaults to on when an AI agent runs the command.