Last update: 2025-12-15T09:56:58.000Z
Content:
---
title: "tb fmt · Tinybird Docs"
theme-color: "#171612"
description: "Formats a .datasource or .pipe file"
inkeep:version: "forward"
---




## tb fmt [¶](https://www.tinybird.co/docs/forward/dev-reference/commands/tb-fmt#tb-fmt)

Formats a .datasource or .pipe file. .connection files are not *yet* supported.

These are the options available for the `fmt` command:

| 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 overwrite the local file. |
| --yes | Don't ask for confirmation to overwrite the local file. |
| --diff | Outputs correctly formatted block (if differs from local file) and prompts to apply correction to local file. |

This command applies opinionated formatting rules and may reorder file properties for consistency. For example, these properties:

ENGINE "MergeTree"
ENGINE_SORTING_KEY "name"
ENGINE_PARTITION_KEY "name" will be formatted as:

ENGINE MergeTree
ENGINE_PARTITION_KEY name
ENGINE_SORTING_KEY name 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 `pre-commit` hook to have your files properly formatted. If the SQL formatting results aren't what you expect, you can disable it just for the blocks needed. Read [how to disable fmt](https://docs.sqlfmt.com/getting-started/disabling-sqlfmt).


