tb sql¶
Run SQL query over data sources and pipes. Global options apply to this command. See Global options.
Options¶
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. |
Examples¶
The following example shows how to run a SELECT statement with count:
tb sql "SELECT count(*) from tinybird.endpoint_errors" Running against Tinybird Local count() UInt64 ─────────── 0
The following example shows how to use the --rows_limit
and --stats
options:
tb sql --rows_limit 5 --stats "SELECT start_datetime, duration, pipe_name from tinybird.pipe_stats_rt" Running against Tinybird Local ** Query took 0.004044331 seconds ** Rows read: 142 ** Bytes read: 10.12 KB start_datetime duration pipe_name DateTime Float32 String ────────────────────────────────────────────────── 2025-03-12 16:07:16 0.05388069 query_api ────────────────────────────────────────────────── 2025-03-12 16:07:27 0.0040593147 query_api ────────────────────────────────────────────────── 2025-03-12 16:09:03 0.026257038 query_api ────────────────────────────────────────────────── 2025-03-12 16:15:27 0.03177452 query_api ────────────────────────────────────────────────── 2025-03-12 16:15:33 0.010550499 query_api