CLI command reference

The following list shows all available commands in the Tinybird command-line interface, their options, and their arguments.

This is an experimental version of the Tinybird CLI. Send your feedback to support@tinybird.co.

Global options

The following options are available for all commands.

Enter them before the command name. For example: tb --host https://api.tinybird.co workspace ls.

OptionDescription
--host TEXTTinybird host. Defaults to the value of the TB_HOST environment variable, then to https://api.tinybird.co.
--token TEXTAuthentication token. Defaults to the value of the TB_TOKEN environment variable, then to the .tinyb file.
--show-tokensShows available tokens.
--prod / --localRun against production or local environment.
--folder DIRECTORYFolder where your data project files are located.
--debug / --no-debugPrints internal representation. Combine it with any command to get more information.
--versionShows the version and exits.
-h, --helpShows help for the command.

tb auth

Configures your Tinybird authentication.

OptionDescription
--host TEXTTinybird host. Defaults to the value of the TB_HOST environment variable, then to https://api.tinybird.co.
--token TEXTAuthentication token. Defaults to the value of the TB_TOKEN environment variable, then to the .tinyb file.
--region TEXTRegion to authenticate to.
--connector [bigquery]Set credentials for one of the supported connectors.
-i / --interactiveInteractive mode.

tb build

Builds your project and checks that all the resources are valid.

Pass the --watch flag to watch for changes and rebuild the project automatically.

When in watch mode you can run SQL queries against the project and also run commands.

tb copy

Manages copy pipes. The following subcommands are available:

SubcommandDescription
lsLists all the copy pipes.
run [OPTIONS] PIPE_NAME_OR_IDRuns a copy job.
pause PIPE_NAME_OR_IDPauses a copy job.
resume PIPE_NAME_OR_IDResumes a copy job.

tb copy run

Runs a copy job.

OptionDescription
--wait / --no-waitWaits for the copy job to finish.
--mode [append|replace]Defines the copy strategy.
--yesDoes not ask for confirmation.
--param TEXTKey and value of the params you want the Copy pipe to be called with. For example: tb pipe copy run <my_copy_pipe> --param foo=bar

tb create

Creates an empty data project with CI/CD configuration files and a git repository.

Pass the --prompt flag to generate a customized starter project based on your prompt.

OptionDescription
--prompt STRINGPrompt to generate a customized initial project.
--rows INTEGERNumber of events to send.
--data PATHCreates a data project based on the files in the specified directory
--folder PATHFolder where datafiles are placed.
--cursorCreate a .cursorrules file with Tinybird rules.

tb datasource

Manages data sources. The following subcommands are available:

SubcommandDescription
analyze URL_OR_FILEAnalyzes a URL or a file before creating a new data source.
append DATASOURCE_NAME URLAppends data to an existing Data Source from URL, local file or a connector. For example, tb datasource append my_datasource https://my_url.com.
delete [OPTIONS] DATASOURCE_NAMEDeletes rows from a data source.
ls [OPTIONS]Lists Data Sources.
replace DATASOURCE_NAME URLReplaces the data in a Data Source from a URL, local file or a connector.
truncate [OPTIONS] DATASOURCE_NAMETruncates a Data Source.

tb datasource delete

Deletes a data source. For example, tb datasource delete my_datasource --wait.

OptionDescription
--yesDoes not ask for confirmation.
--waitWaits for delete job to finish.
--dry-runRuns the command without deleting anything.

tb datasource ls

Lists data sources.

OptionDescription
--match TEXTRetrieves any resource matching the pattern.
--format [json]Returns the results in the specified format.

tb datasource truncate

Truncates a data source. For example, tb datasource truncate my_datasource.

OptionDescription
--yesDoes not ask for confirmation.
--cascadeTruncates the dependent data source attached in cascade to the given data source.

tb deployment

Deploys your project to the Tinybird platform. Run using --prod to deploy to production.

The following subcommands are available:

SubcommandDescription
create [OPTIONS]Validates and deploy the project in Tinybird.
lsLists all the deployments of your project.
promotePromotes last deploy to ready and remove old one.
rollbackRollbacks to the previous deployment.

tb deployment create

Validates and deploy the project in Tinybird. Run using --prod to deploy to production.

You can also tb deploy as an alias of tb deployment create.

OptionDescription
--wait / --no-waitWaits for the deployment to finish. Defaults to not waiting.
--auto / --no-autoAutomatically promotes the deployment. Only works if --wait is used.

tb diff

Diffs local datafiles to the corresponding remote files in the Workspace.

OptionDescription
--fmt / --no-fmtFormat files before doing the diff, default is True so both files match the format.
--no-colorDon't colorize diff.
--no-verboseList the resources changed not the content of the diff.

Remote files are downloaded and stored locally in a .diff_tmp directory. If you're versioning the project with git, you can add the directory to the .gitignore list.

tb endpoint

Manage endpoints. The following subcommands are available:

SubcommandDescription
data PIPEPrints data returned by the endpoint.
ls [OPTIONS]Lists all the endpoints.
stats [OPTIONS] PIPEPrints stats of the last 7 days for an endpoint.
token PIPERetrieves a token to call an endpoint.
url PIPEPrints the URL of an endpoint.

tb endpoint data

Prints data returned by the endpoint.

OptionDescription
--query TEXTRuns a query over endpoint results.
--format [json|csv]Returns the results in the specified format.

tb endpoint ls

Lists all the endpoints.

OptionDescription
--match TEXTRetrieves any resource matching the pattern. For example, --match _test.
--format [json]Returns the results in the specified format.

tb endpoint stats

Prints stats of the last 7 days for an endpoint.

OptionDescription
--format [json]Returns the results in the specified format.

tb fmt

Formats a datafile. For example: tb fmt my_datasource.datasource.

The following options are available:

OptionDescription
--line-length INTEGERA number indicating the maximum characters per line in the node SQL, lines split based on the SQL syntax and the number of characters passed as a parameter.
--dry-runDon't ask to override the local file.
--yesDon't ask for confirmation to overwrite the local file.
--diffFormats local file, prints the diff and exits with 1 if different or 0 if equal.

This command removes comments starting with # from the file, so use DESCRIPTION or a comment block instead:

Example comment block
%
{% comment this is a comment and fmt keeps it %}

SELECT
  {% comment this is another comment and fmt keeps it %}
  count() c
FROM stock_prices_1m

You can add tb fmt to your git precommit hook to have your files properly formatted. If the SQL formatting results aren't the ones expected to you, you can disable it for the blocks needed. Read how to disable fmt.

tb job

Manage jobs. The following subcommands are available:

SubcommandDescription
cancel JOB_IDTries to cancel a job.
details JOB_IDGets details for any job created in the last 48h.
ls [OPTIONS]Lists jobs. Use --status [waiting|working|done|error] or -s to show results with the desired status.

tb local

Manages the local development environment. The following subcommands are available:

SubcommandDescription
startStarts the local development environment.
restartRestarts the local development environment.
stopStops the local development environment.
removeRemoves the local development environment.

tb login

Authenticates with your Tinybird account.

The command opens a browser window so that you can authenticate with your Tinybird account.

OptionDescription
--host TEXTSet custom host if it's different than https://api.tinybird.co. Check https://www.tinybird.co/docs/api-reference/overview#regions-and-endpoints for the available list of regions.
--workspace TEXTSet the workspace to authenticate to. If not set, the default workspace will be used.

tb materialization

Manage materialized views. The following subcommands are available:

SubcommandDescription
lsLists materialized views.
populatePopulates a materialized view.

tb materialization ls

Lists materialized views.

OptionDescription
--match TEXTRetrieves any resource matching the pattern.
--format [json]Returns the results in the specified format.

tb materialization populate

Populates a materialized view.

OptionDescription
--node TEXTName of the materialized node.
--sql-condition TEXTPopulates with a SQL condition to be applied to the trigger Data Source of the Materialized View. For instance, --sql-condition='date == toYYYYMM(now())' populates taking all the rows from the trigger data source where date is the current month. Use it together with --populate.
--truncateTruncates the materialized Data Source before populating it.
--unlink-on-populate-errorIf the populate job fails the materialized view is unlinked and new data won't be ingested in the materialized view. First time a populate job fails, the materialized view is always unlinked.
--waitWaits for populate jobs to finish, showing a progress bar. Disabled by default.

tb mock

Generates sample data in /fixtures and sends it to the Data Source.

The command accepts a Data Source name as an argument. For example: tb mock events

OptionDescription
--rows INTEGERNumber of rows to generate.
--prompt TEXTExtra context to use for data generation.
--skipSkips following up on the generated data.

tb pull

Retrieves the latest version for project files from your workspace.

OptionDescription
--folder DIRECTORYFolder where files are placed.
-f, --forceOverride existing files.
--fmtFormat files, following the same format as tb fmt.

tb sql

Run SQL query over data sources and pipes.

OptionDescription
--rows_limit INTEGERMax number of rows retrieved.
--pipeline TEXTThe name of the Pipe to run the SQL Query.
--pipe TEXTThe path to the .pipe file to run the SQL Query of a specific NODE.
--node TEXTThe NODE name.
--format [json|csv|human]Output format.
--stats / --no-statsShows query stats.

tb test

Generates and runs tests. The following subcommands are available:

CommandDescription
create [OPTIONS]Creates a test in YAML format from a pipe datafile.
run [FILES]Runs all the tests in the project or specific tests passed as arguments.
update [FILES]Updates the test's expectations.

tb test create

Creates a test in YAML format from an API endpoint.

For example: tb test create api_events --prompt "test for the customer id 42 and the event type 'purchase'".

OptionDescription
--prompt TEXTPasses a prompt to generate a customized test.
--skipSkips the test creation process and only generate the test file.

tb test run

Runs all the tests in the project tb test run or specific tests passed as arguments. For example: tb test tests/run api_events.yaml.

OptionDescription
--folder DIRECTORYFolder where tests are located.

tb test update

Updates the test's expectations. For example: tb test update api_events.

OptionDescription
--folder DIRECTORYFolder where tests are located.

tb upgrade

Upgrades the CLI to the latest version.

tb workspace

Manage your Workspaces. The following subcommands are available:

SubcommandDescription
create [OPTIONS] WORKSPACE_NAMECreates a new Workspace for your Tinybird user.
currentShows the Workspace you're currently authenticated to.
delete [OPTIONS] WORKSPACE_NAME_OR_IDDeletes a Workspace where you are an admin.
lsLists all the Workspaces you have access to in the account you're currently authenticated to.
members add [OPTIONS] MEMBERS_EMAILSAdds members to the current Workspace.
members ls [OPTIONS]Lists members in the current Workspace.
members rm [OPTIONS]Removes members from the current Workspace.
members set-role [OPTIONS] [guest|viewer|admin] MEMBERS_EMAILSSets the role for existing Workspace members.
use WORKSPACE_NAME_OR_IDSwitches to another workspace. Use tb workspace ls to list the workspaces you have access to.

tb workspace create

Creates a new Workspace for your Tinybird user.

OptionDescription
--starter_kit URLUses a Tinybird starter kit as a template.
--forkWhen enabled, Tinybird shares all data sources from the current workspace to the new one.
--user_token TEXTWhen passed, Tinybird won't prompt asking for it.

tb workspace delete

Deletes a Workspace where you are an admin.

OptionDescription
--user_token TEXTWhen passed, Tinybird won't prompt asking for it.
--yesDon't ask for confirmation.

tb workspace members add

Adds members to the current Workspace. Takes a list of members emails as an argument.

OptionDescription
--role [guest|viewer|admin]Sets the role for the members.
--user_token TEXTWhen passed, Tinybird won't prompt asking for it.

tb workspace members rm

Removes members from the current Workspace. Takes a list of members emails as an argument.

OptionDescription
--user_token TEXTWhen passed, Tinybird won't prompt asking for it.

tb workspace members set-role

Sets the role for existing Workspace members.

OptionDescription
--user_token TEXTWhen passed, Tinybird won't prompt asking for it.

tb workspace use

Switches to another workspace. Use tb workspace ls to list the workspaces you have access to.

OptionDescription
--user_token TEXTWhen passed, Tinybird won't prompt asking for it.
Updated