Skip to content

Latest commit

 

History

History
132 lines (91 loc) · 2.83 KB

intro-to-cli.md

File metadata and controls

132 lines (91 loc) · 2.83 KB

An introduction to the Tinybird CLI

What we will do in this session:

  • Install the CLI.
  • Exploring our Workspace with the CLI.
  • Touring available commands and preparing for managing projects under version control.

Screencasts:

Documentation:

Installing the CLI

Here, we are creating a .temp-project virtual environment, loading the environment, then installing the tinybird-cli with PIP.

python3 -m venv .temp-project
source .temp-project/bin/activate

pip3 install tinybird-cli

Example commands

Getting started

  • tb --help
  • tb auth --help
    • --interactive
  • tb init --help
    • --git
    • --cicd
    • --generate-datasources
    • --force
    • --folder

Commands for working directly with Tinybird core objects:

  • tb workspace --help

    • tb workspace [OPTIONS] COMMAND [ARGS]
    • ls / current / create / delete / use
    • tb workspace create --fork
  • tb datasource --help

    • tb datasource [OPTIONS] COMMAND [ARGS]
    • ls / generate / truncate / analyze / append / connect / copy / rm
  • tb pipe --

    • tb pipe [OPTIONS] COMMAND [ARGS]
    • ls / generate / publish / unpublish / rm / stats
  • tb materialize --help

    • tb materialize [OPTIONS] FILENAME [TARGET_DATASOURCE]

Commands for working with version control

  • tb branch --help
    • tb branch [OPTIONS] COMMAND [ARGS]
    • ls / create / current / data / datasource / rm
  • tb deploy --help
    • tb deploy [OPTIONS]
    • tb --semver deploy
    • semver format is major.minor.patch-post where major, minor, patch and post are integer numbers.

Utilities:

  • tb fmt --help
  • tb sql --help
  • tb check --help
  • tb pull --help
    • --auto --force
  • tb push --help
    • --auto --force

A tour of our project

  • Install CLI if needed:

    python3 -m venv .temp-project
    source .temp-project/bin/activate
    pip3 install tinybird-cli
  • Authenticate with Tinybird Auth Token

    • Using admin @email Token.
    tb auth
  • Explore the CLI and project

    tb --help
    
    tb workspace ls
    
    tb datasource ls
    
    tb pipe ls
    
    tb sql "SELECT COUNT(*) FROM event_stream"
    tb sql "SELECT timestamp,symbol,price FROM event_stream WHERE symbol='ALG' LIMIT 10"
    
    tb branch ls
  • Download resources from Tinybird

    tb pull --auto
  • Create a new Workspace

tb workspace create cli_temp