Skip to content
Cloudflare Docs

WranglerNamespace

The WranglerNamespace component documents the available commands for a given namespace.

This is generated using the Wrangler version in the cloudflare-docs repository.

Import

import { WranglerNamespace } from "~/components";

Usage

d1 list

List D1 databases

Terminal window
npx wrangler d1 list
  • --json boolean default: false

    Return output as clean JSON

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 info

Get information about a D1 database, including the current database size and state

Terminal window
npx wrangler d1 info [NAME]
  • [NAME] string required

    The name of the DB

  • --json boolean default: false

    Return output as clean JSON

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 insights

Get information about the queries run on a D1 database.

Terminal window
npx wrangler d1 insights [NAME]
  • [NAME] string required

    The name of the DB

  • --timePeriod string default: 1d

    Fetch data from now to the provided time period

  • --sort-type string default: sum

    Choose the operation you want to sort insights by

  • --sort-by string default: time

    Choose the field you want to sort insights by

  • --sort-direction string default: DESC

    Choose a sort direction

  • --limit number default: 5

    fetch insights about the first X queries

  • --json boolean default: false

    return output as clean JSON

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 create

Create D1 database

Terminal window
npx wrangler d1 create [NAME]
  • [NAME] string required

    The name of the new DB

  • --location string

    A hint for the primary location of the new DB. Options: weur: Western Europe eeur: Eastern Europe apac: Asia Pacific oc: Oceania wnam: Western North America enam: Eastern North America

  • --jurisdiction string

    The location to restrict the D1 database to run and store data within to comply with local regulations. Note that if jurisdictions are set, the location hint is ignored. Options: eu: The European Union fedramp: FedRAMP-compliant data centers

  • --use-remote boolean

    Use a remote binding when adding the newly created resource to your config

  • --update-config boolean

    Automatically update your config file with the newly added resource

  • --binding string

    The binding name of this resource in your Worker

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 delete

Delete D1 database

Terminal window
npx wrangler d1 delete [NAME]
  • [NAME] string required

    The name or binding of the DB

  • --skip-confirmation boolean alias: --y default: false

    Skip confirmation

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 execute

Execute a command or SQL file

Terminal window
npx wrangler d1 execute [DATABASE]
  • [DATABASE] string required

    The name or binding of the DB

  • --yes boolean alias: --y

    Answer "yes" to any prompts

  • --local boolean

    Execute commands/files against a local DB for use with wrangler dev

  • --remote boolean

    Execute commands/files against a remote DB for use with wrangler dev

  • --file string

    A .sql file to ingest

  • --command string

    A single SQL statement to execute

  • --persist-to string

    Specify directory to use for local persistence (for --local)

  • --json boolean default: false

    Return output as clean JSON

  • --preview boolean default: false

    Execute commands/files against a preview D1 DB

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 export

Export the contents or schema of your database as a .sql file

Terminal window
npx wrangler d1 export [NAME]
  • [NAME] string required

    The name of the DB

  • --local boolean

    Export from your local DB you use with wrangler dev

  • --remote boolean

    Export from your live D1

  • --no-schema boolean

    Only output table contents, not the DB schema

  • --no-data boolean

    Only output table schema, not the contents of the DBs themselves

  • --table string

    Specify which tables to include in export

  • --output string required

    Which .sql file to output to

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 time-travel info

Retrieve information about a database at a specific point-in-time using Time Travel

Terminal window
npx wrangler d1 time-travel info [DATABASE]
  • [DATABASE] string required

    The name or binding of the DB

  • --timestamp string

    Accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for

  • --json boolean default: false

    Return output as clean JSON

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 time-travel restore

Restore a database back to a specific point-in-time

Terminal window
npx wrangler d1 time-travel restore [DATABASE]
  • [DATABASE] string required

    The name or binding of the DB

  • --bookmark string

    Bookmark to use for time travel

  • --timestamp string

    Accepts a Unix (seconds from epoch) or RFC3339 timestamp (e.g. 2023-07-13T08:46:42.228Z) to retrieve a bookmark for

  • --json boolean default: false

    Return output as clean JSON

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 migrations list

List your D1 migrations

Terminal window
npx wrangler d1 migrations list [DATABASE]
  • [DATABASE] string required

    The name or binding of the DB

  • --local boolean

    Execute commands/files against a local DB for use with wrangler dev

  • --remote boolean

    Execute commands/files against a remote DB for use with wrangler dev --remote

  • --preview boolean default: false

    Execute commands/files against a preview D1 DB

  • --persist-to string

    Specify directory to use for local persistence (you must use --local with this flag)

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 migrations create

Create a new migration

Terminal window
npx wrangler d1 migrations create [DATABASE] [MESSAGE]
  • [DATABASE] string required

    The name or binding of the DB

  • [MESSAGE] string required

    The Migration message

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

d1 migrations apply

Apply D1 migrations

Terminal window
npx wrangler d1 migrations apply [DATABASE]
  • [DATABASE] string required

    The name or binding of the DB

  • --local boolean

    Execute commands/files against a local DB for use with wrangler dev

  • --remote boolean

    Execute commands/files against a remote DB for use with wrangler dev --remote

  • --preview boolean default: false

    Execute commands/files against a preview D1 DB

  • --persist-to string

    Specify directory to use for local persistence (you must use --local with this flag)

Global flags

  • --v boolean alias: --version

    Show version number

  • --cwd string

    Run as if Wrangler was started in the specified directory instead of the current working directory

  • --config string alias: --c

    Path to Wrangler configuration file

  • --env string alias: --e

    Environment to use for operations, and for selecting .env and .dev.vars files

  • --env-file string

    Path to an .env file to load - can be specified multiple times - values from earlier files are overridden by values in later files

  • --experimental-provision boolean aliases: --x-provision default: true

    Experimental: Enable automatic resource provisioning

  • --experimental-auto-create boolean alias: --x-auto-create default: true

    Automatically provision draft bindings with new resources

import { WranglerNamespace } from "~/components";
<WranglerNamespace namespace="d1" />

Arguments

  • namespace string required
    • The namespace to pull the related commands from (d1, hyperdrive).
  • headingLevel boolean (default: 2) optional
    • The heading level that the commands should be added at on the page, i.e 2 for h2.