Check out v4 of the Fauna CLI

v4 of the Fauna CLI is now in beta.

The new version introduces enhancements to the developer experience, including an improved authentication workflow. To get started, check out the CLI v4 quick start.

fauna run-queries

Run the queries from a file.

Syntax

fauna run-queries [<DBNAME>] [<QUERY>] [--[no-]color ]
  [--file <value>] [--endpoint <value>] [--environment <value>]
  [--format json|json-tagged|shell] [--output <value>]
  [--secret <value>] [--stdin] [--timeout <value>]
  [--typecheck] [--url <value>] [--version 4|10]

Description

Run the queries provided in file.

By default, this command supports FQL v10 queries. For FQL v4 queries, use the --version 4 option.

FQL v4 access

Fauna accounts created after August 21, 2024 can’t use --version 4 or otherwise run FQL v4 queries.

Arguments

Argument Description

<DBNAME>

Database name.

<QUERY>

FQL query to run.

Options

Option Description

--[no-]color

Enables or disables color formatting for the output. Color formatting is enabled by default if the terminal supports it (determined using chalk/supports-color). Use --no-color to disable.

--endpoint

Connection endpoint from .fauna-shell.

--environment

Environment to use, from a Fauna project.

--file

Name of file with queries to run.

--format

Output format:
     json
     json-tagged
     shell

--help

Help for run-queries command.

--output

File to write output to.

--secret

Authentication secret. Overrides the secret in .fauna-shell.

Use a scoped key to interact with a child database using a parent database’s admin key.

For example, with a parent database’s admin key secret of fn123, you can access a child database by appending the child database name and role: fn123:childDB:admin.

--stdin

Read file input from stdin. Write to stdout by default.

--timeout

Connection timeout (milliseconds).

--typecheck

Enable typechecking.

--url

Database URL. Overrides the URL in .fauna-shell.

--version

FQL Version:
     4 = FQL version 4
     10 = (default) FQL version 10

Examples

fauna run-queries dbname --file=/path/to/queries.fql

Is this article helpful? 

Tell Fauna how the article can be improved:
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!