PlanetScale
PlanetScale is a managed MySQL-compatible database built on Vitess.
ingestr supports PlanetScale as both a source and destination through the MySQL connector. PlanetScale change data capture is also supported through Vitess VStream.
URI format
The URI format for PlanetScale is as follows:
mysql://user:password@host:port/database?tls=trueURI parameters:
user: the user name to connect to the databasepassword: the password for the userhost: the PlanetScale database hostport: the MySQL protocol port, usually 3306database: the PlanetScale database nametls=true: required for PlanetScale connections
Use the same URI structure for sources and destinations. PlanetScale uses the MySQL wire protocol, so the URI scheme remains mysql://.
Example:
ingestr ingest \
--source-uri "mysql://user:password@host:3306/database?tls=true" \
--dest-uri "duckdb:///tmp/planetscale.duckdb" \
--source-table "orders" \
--dest-table "orders"To load into PlanetScale, use the PlanetScale URI as the destination:
ingestr ingest \
--source-uri "postgresql://user:password@host:5432/app" \
--dest-uri "mysql://user:password@host:3306/database?tls=true" \
--source-table "public.orders" \
--dest-table "orders"Change data capture
PlanetScale CDC uses the mysql+cdc:// URI scheme. ingestr detects PlanetScale as a Vitess-compatible server and streams changes through vtgate's VStream API over gRPC.
mysql+cdc://user:password@host:3306/database?grpc_port=<grpc-port>&mode=batch&tls=trueCDC over PlanetScale opens two connections:
- the MySQL protocol connection for schema discovery
- the vtgate gRPC connection for the change stream
The tls=true parameter secures both connections. The gRPC connection inherits the tls setting, so PlanetScale CDC usually needs only grpc_port plus tls=true.
Example:
ingestr ingest \
--source-uri "mysql+cdc://user:password@host:3306/database?grpc_port=15991&mode=batch&tls=true" \
--dest-uri "duckdb:///tmp/planetscale_cdc.duckdb" \
--source-table "orders" \
--dest-table "orders"CDC URI parameters:
grpc_port: required vtgate gRPC port. This is different from the MySQL protocol port and cannot be derived automatically.grpc_host: optional vtgate gRPC host; defaults to the host in the URI.grpc_tls: optional override for the gRPC connection's TLS, independent oftls.trueverifies the server certificate,skip-verifyskips verification, andfalseforces plaintext.mode:batch; defaults tobatch.dest_schema: optional destination schema for multi-table CDC runs.
Requirements:
- The vtgate gRPC endpoint must be reachable.
- Source tables must have primary keys, or
--primary-keymust be provided. - Source tables must not contain
ENUM,SET, orBITcolumns.
PlanetScale CDC performs a consistent copy-phase snapshot first, then streams changes. Position is tracked in _cdc_lsn, and subsequent runs resume from the destination table's maximum _cdc_lsn. If the stored _cdc_lsn is invalid, the run fails instead of taking a partial snapshot. Run with --full-refresh to rebuild the destination from a fresh snapshot.
Incremental CDC runs use the merge strategy so updates and deletes can be applied by primary key.
Related docs
- MySQL for the generic MySQL connector and binary-log CDC behavior.
- Vitess VStream for the underlying change stream API.