Using Ro With aer
--aerdb, --incremental, and --dependencies flags are pre-release functionality and subject to change.ro --aerdb writes a backup of your org’s records to a database that aer can run against. Use it to run the aer development server or aer exec with your org’s records instead of an empty database.
The flags on this page are in the ro 2.6 beta releases, on the releases page.
Create the database
Pass --aerdb a SQLite file path:
ro -e login.salesforce.com --aerdb backup.dbro builds the database schema from the org’s describe metadata. The tables have typed columns and foreign keys, and use the org’s record type Ids and Id key prefixes. The SQLite file must not already exist.
Then start aer with --db and the org’s metadata source:
aer server --db backup.db force-appaer builds its runtime schema from the source directories and packages it is given. A custom object in the backup that is not defined by the source or a package is not visible to SOQL or Apex, so run aer with the source for the same org you backed up.
Back up a subset of objects
List objects to back up only those objects, and add --dependencies to include the objects they reference:
ro -e login.salesforce.com --aerdb backup.db --dependencies Opportunity--dependencies adds the objects referenced through lookup and master-detail fields, including every target of a polymorphic field, and repeats for each added object until no new object is found. Child relationships are not followed.
Objects load in any order. A record that references an object outside the backup is loaded with foreign-key enforcement suspended.
Use PostgreSQL
--aerdb also accepts a postgres:// URL, which aer server and aer exec accept with --db:
ro -e login.salesforce.com --aerdb postgres://user@localhost/backup
aer server --db postgres://user@localhost/backup force-appThe PostgreSQL database is created if it does not exist, and must be empty if it does. Loading requires a superuser connection. --s3-bucket cannot be combined with a PostgreSQL URL.
Update an existing database
--incremental updates an existing --aerdb database in place:
ro -e login.salesforce.com --aerdb backup.db --incrementalEach object’s export is limited to records created, modified, or deleted since the newest record in its table, using SystemModstamp, LastModifiedDate, or CreatedDate, whichever the object has. An object whose table is empty is exported in full. A record deleted in Salesforce since the last export is marked deleted in the database.
If the database does not exist, --incremental performs a full backup that creates it, so you can pass the flag on every run. --incremental requires --aerdb and cannot be combined with --since.
The default user
The Salesforce user running the backup becomes the database’s default user. aer server and aer exec run as that user. Before loading records, ro reads that user and its profile name from the org and creates a User row and a Profile row under their org Ids. When the backup includes the User and Profile objects, the org’s records update those rows.
Base64 fields
Base64 field content, such as ContentVersion.VersionData and Attachment.Body, is downloaded one record at a time and stored in the record’s column. Pass --exclude-base64 to skip it.
Limitations
- The database holds aer’s runtime tables in addition to the object tables, and its triggers call SQL functions that only aer registers. The
sqlite3tool cannot work with it. Use--dsnwhen you want a database to read withsqlite3. - Objects that the aer schema models as views, such as
ContentNoteandAggregateResult, are skipped. - Records the database rejects are skipped and counted in one log line per object.