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
.
Option | Description |
---|---|
--host TEXT | Tinybird host. Defaults to the value of the TB_HOST environment variable, then to https://api.tinybird.co . |
--token TEXT | Authentication token. Defaults to the value of the TB_TOKEN environment variable, then to the .tinyb file. |
--show-tokens | Shows available tokens. |
--prod / --local | Run against production or local environment. |
--folder DIRECTORY | Folder where your data project files are located. |
--debug / --no-debug | Prints internal representation. Combine it with any command to get more information. |
--version | Shows the version and exits. |
-h, --help | Shows help for the command. |
tb auth¶
Configures your Tinybird authentication.
Option | Description |
---|---|
--host TEXT | Tinybird host. Defaults to the value of the TB_HOST environment variable, then to https://api.tinybird.co . |
--token TEXT | Authentication token. Defaults to the value of the TB_TOKEN environment variable, then to the .tinyb file. |
--region TEXT | Region to authenticate to. |
--connector [bigquery] | Set credentials for one of the supported connectors. |
-i / --interactive | Interactive 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:
Subcommand | Description |
---|---|
ls | Lists all the copy pipes. |
run [OPTIONS] PIPE_NAME_OR_ID | Runs a copy job. |
pause PIPE_NAME_OR_ID | Pauses a copy job. |
resume PIPE_NAME_OR_ID | Resumes a copy job. |
tb copy run¶
Runs a copy job.
Option | Description |
---|---|
--wait / --no-wait | Waits for the copy job to finish. |
--mode [append|replace] | Defines the copy strategy. |
--yes | Does not ask for confirmation. |
--param TEXT | Key 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.
Option | Description |
---|---|
--prompt STRING | Prompt to generate a customized initial project. |
--rows INTEGER | Number of events to send. |
--data PATH | Creates a data project based on the files in the specified directory |
--folder PATH | Folder where datafiles are placed. |
--cursor | Create a .cursorrules file with Tinybird rules. |
tb datasource¶
Manages data sources. The following subcommands are available:
Subcommand | Description |
---|---|
analyze URL_OR_FILE | Analyzes a URL or a file before creating a new data source. |
append DATASOURCE_NAME URL | Appends 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_NAME | Deletes rows from a data source. |
ls [OPTIONS] | Lists Data Sources. |
replace DATASOURCE_NAME URL | Replaces the data in a Data Source from a URL, local file or a connector. |
truncate [OPTIONS] DATASOURCE_NAME | Truncates a Data Source. |
tb datasource delete¶
Deletes a data source. For example, tb datasource delete my_datasource --wait
.
Option | Description |
---|---|
--yes | Does not ask for confirmation. |
--wait | Waits for delete job to finish. |
--dry-run | Runs the command without deleting anything. |
tb datasource ls¶
Lists data sources.
Option | Description |
---|---|
--match TEXT | Retrieves 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
.
Option | Description |
---|---|
--yes | Does not ask for confirmation. |
--cascade | Truncates 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:
Subcommand | Description |
---|---|
create [OPTIONS] | Validates and deploy the project in Tinybird. |
ls | Lists all the deployments of your project. |
promote | Promotes last deploy to ready and remove old one. |
rollback | Rollbacks 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
.
Option | Description |
---|---|
--wait / --no-wait | Waits for the deployment to finish. Defaults to not waiting. |
--auto / --no-auto | Automatically promotes the deployment. Only works if --wait is used. |
tb diff¶
Diffs local datafiles to the corresponding remote files in the Workspace.
Option | Description |
---|---|
--fmt / --no-fmt | Format files before doing the diff, default is True so both files match the format. |
--no-color | Don't colorize diff. |
--no-verbose | List 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:
Subcommand | Description |
---|---|
data PIPE | Prints data returned by the endpoint. |
ls [OPTIONS] | Lists all the endpoints. |
stats [OPTIONS] PIPE | Prints stats of the last 7 days for an endpoint. |
token PIPE | Retrieves a token to call an endpoint. |
url PIPE | Prints the URL of an endpoint. |
tb endpoint data¶
Prints data returned by the endpoint.
Option | Description |
---|---|
--query TEXT | Runs a query over endpoint results. |
--format [json|csv] | Returns the results in the specified format. |
tb endpoint ls¶
Lists all the endpoints.
Option | Description |
---|---|
--match TEXT | Retrieves 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.
Option | Description |
---|---|
--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:
Option | Description |
---|---|
--line-length INTEGER | A 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-run | Don't ask to override the local file. |
--yes | Don't ask for confirmation to overwrite the local file. |
--diff | Formats 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:
Subcommand | Description |
---|---|
cancel JOB_ID | Tries to cancel a job. |
details JOB_ID | Gets 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:
Subcommand | Description |
---|---|
start | Starts the local development environment. |
restart | Restarts the local development environment. |
stop | Stops the local development environment. |
remove | Removes 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.
Option | Description |
---|---|
--host TEXT | Set 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 TEXT | Set the workspace to authenticate to. If not set, the default workspace will be used. |
tb materialization¶
Manage materialized views. The following subcommands are available:
Subcommand | Description |
---|---|
ls | Lists materialized views. |
populate | Populates a materialized view. |
tb materialization ls¶
Lists materialized views.
Option | Description |
---|---|
--match TEXT | Retrieves any resource matching the pattern. |
--format [json] | Returns the results in the specified format. |
tb materialization populate¶
Populates a materialized view.
Option | Description |
---|---|
--node TEXT | Name of the materialized node. |
--sql-condition TEXT | Populates 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 . |
--truncate | Truncates the materialized Data Source before populating it. |
--unlink-on-populate-error | If 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. |
--wait | Waits 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
Option | Description |
---|---|
--rows INTEGER | Number of rows to generate. |
--prompt TEXT | Extra context to use for data generation. |
--skip | Skips following up on the generated data. |
tb pull¶
Retrieves the latest version for project files from your workspace.
Option | Description |
---|---|
--folder DIRECTORY | Folder where files are placed. |
-f, --force | Override existing files. |
--fmt | Format files, following the same format as tb fmt . |
tb sql¶
Run SQL query over data sources and pipes.
Option | Description |
---|---|
--rows_limit INTEGER | Max number of rows retrieved. |
--pipeline TEXT | The name of the Pipe to run the SQL Query. |
--pipe TEXT | The path to the .pipe file to run the SQL Query of a specific NODE. |
--node TEXT | The NODE name. |
--format [json|csv|human] | Output format. |
--stats / --no-stats | Shows query stats. |
tb test¶
Generates and runs tests. The following subcommands are available:
Command | Description | |
---|---|---|
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'"
.
Option | Description |
---|---|
--prompt TEXT | Passes a prompt to generate a customized test. |
--skip | Skips 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
.
Option | Description |
---|---|
--folder DIRECTORY | Folder where tests are located. |
tb test update¶
Updates the test's expectations. For example: tb test update api_events
.
Option | Description |
---|---|
--folder DIRECTORY | Folder where tests are located. |
tb upgrade¶
Upgrades the CLI to the latest version.
tb workspace¶
Manage your Workspaces. The following subcommands are available:
Subcommand | Description |
---|---|
create [OPTIONS] WORKSPACE_NAME | Creates a new Workspace for your Tinybird user. |
current | Shows the Workspace you're currently authenticated to. |
delete [OPTIONS] WORKSPACE_NAME_OR_ID | Deletes a Workspace where you are an admin. |
ls | Lists all the Workspaces you have access to in the account you're currently authenticated to. |
members add [OPTIONS] MEMBERS_EMAILS | Adds 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_EMAILS | Sets the role for existing Workspace members. |
use WORKSPACE_NAME_OR_ID | Switches 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.
Option | Description |
---|---|
--starter_kit URL | Uses a Tinybird starter kit as a template. |
--fork | When enabled, Tinybird shares all data sources from the current workspace to the new one. |
--user_token TEXT | When passed, Tinybird won't prompt asking for it. |
tb workspace delete¶
Deletes a Workspace where you are an admin.
Option | Description |
---|---|
--user_token TEXT | When passed, Tinybird won't prompt asking for it. |
--yes | Don't ask for confirmation. |
tb workspace members add¶
Adds members to the current Workspace. Takes a list of members emails as an argument.
Option | Description |
---|---|
--role [guest|viewer|admin] | Sets the role for the members. |
--user_token TEXT | When 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.
Option | Description |
---|---|
--user_token TEXT | When passed, Tinybird won't prompt asking for it. |
tb workspace members set-role¶
Sets the role for existing Workspace members.
Option | Description |
---|---|
--user_token TEXT | When 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.
Option | Description |
---|---|
--user_token TEXT | When passed, Tinybird won't prompt asking for it. |