fauna schema pull
fauna schema pull [flags]
Pull a database’s remote .fsl schema files into a local directory. By default,
pulls the database’s staged schema.
If the database has no staged schema, the command pulls the database’s active
schema by default. To explicitly pull the database’s active schema, use
--active.
The command runs in the context of a single database, specified using
--database or --secret. If using --secret, the command runs in the
database to which the secret is scoped.
Specify the local directory using --dir. To delete any schema files in the
local directory that are not part of the pulled database schema, use --delete.
Flags
- API
-
-u,--user <string>-
CLI user to run the command as. You must first log in as the user using
fauna login. Defaults todefault. See Interactive login. --local-
Use a local Fauna container.
If not otherwise specified, this flag sets:
-
--urlto http://0.0.0.0:8443 -
--secrettosecret
-
--url <string>-
URL for Core HTTP API requests made by the command. Defaults to https://db.fauna.com.
--secret <string>-
Secret used for authentication. Supports scoped keys. The command runs in the database to which the secret is scoped.
If the secret is a key secret with the
adminrole, you can pass this flag with--databaseand an optional--roleto create and use a scoped key that impersonates a role on a child database. See Scoped keys. --account-key <string>-
Fauna account key used for authentication. If used, you must also provide a
--databaseand an optional--role. See Account key authentication.Can’t be used with
--useror--secret. If--account-keyand--userare specified,--useris ignored. -d,--database <string>-
Database, including the region group identifier and hierarchy, to run the command in. Supports shorthand region group identifiers. Separate path components using
/. Examples:us/my_db,eu/parent_db/child_db,global/db. Can’t be used with--secret.If using a local Fauna container, omit the region group.
-r,--role <string>-
Role used to run the command. Defaults to
admin. Can’t be used with--secret.
- Output
-
--color-
Enable color formatting for output. Enabled by default. Use
--no-colorto disable. --json-
Output results as JSON. This flag doesn’t affect error output.
--jsonhas no effect for this command. --quiet-
Suppress all log messages except fatal errors. Output only command results. Overrides
--verbosityand--verbose-component.
- Config
-
--config <string>-
Path to a CLI config file to use. If provided, must specify a profile.
-p,--profile <string>-
Profile from the CLI config file. A profile is a group of CLI settings.
- Debug
-
--verbose-component <array>-
Components to emit logs for. Overrides
--verbosity.Accepts the following values:
-
argv -
config -
creds -
error -
fetch
Pass values as a space-separated list. Example:
--verbose-component argv config. -
--verbosity <number>-
Least critical log level to emit. Accepts integers ranging from
1(fatal) to5(debug). Lower values represent more critical logs. Log messages with a level greater than this value are not logged.
- Options
-
-h,--help-
Show help.
--version-
Show the Fauna CLI version.
--delete-
Delete
.fslfiles in the local directory that are not part of the pulled schema. --active-
Pull the database’s active schema files. Defaults to false.
If omitted, pull the database’s staged schema, if available.
--fsl-directory,--dir,--directory <string>-
Path to a local directory containing
.fslfiles for the database. Recursively scans subdirectories. Defaults to the current directory (.).
Examples
# Pull the 'us/my_db' database's staged schema.
# If the database has no staged schema, pull the
# active schema.
fauna schema pull \
--database us/my_db \
--dir /path/to/schema/dir
# Pull the staged schema for the database scoped
# to a secret.
fauna schema pull \
--secret my-secret \
--dir /path/to/schema/dir
# Pull the 'us/my_db' database's active schema.
fauna schema pull \
--database us/my_db \
--dir /path/to/schema/dir \
--active
# Delete `.fsl` files in the local directory
# that are not part of the pulled schema.
fauna schema pull \
--database us/my_db \
--dir /path/to/schema/dir \
--delete