1.3.0 • Published 4 years ago

dbt-formatter v1.3.0

Weekly downloads
12
License
MIT
Repository
github
Last release
4 years ago

CircleCI

DBT Formatter

Install

npm install -s dbt-formatter

Usage

import formatter from 'dbt-formatter';

const mySql = "SELECT * FROM {{ ref('myTableRef') }}";
const myOpts = { sql: 'default', indent: 2, upper: false };

formatter.format(mySql, myOpts);

This will result in:

SELECT
  *
FROM
  {{ ref('myTableRef') }}

Usage options

Fine tune dbt-formatter behavior with the following options:

OptionDefaultDescription
sqldefaultThe sql dialect you want to use, currently only default is available
indent2How many spaces you want an indentation to be
upperfalseFormats sql reserved words to be uppercase when set to true
newlinefalseAppends a new line at the end of the formatted sql string
lowerWordsfalseLowercases all words as identified by the tokenizer
allowCamelcasetrueAllows column names to be camelcased

Development

NPM scripts

  • npm test: Run test suite
  • npm start: Run npm run build in watch mode
  • npm run build: Generate bundles and typings, create docs
  • npm run lint: Lints code
  • npm run package: Package dbt-formatter as a binary

Roadmap

  • Add more sql dialects:
    • snowflake
    • redshift
    • bigquery
    • postgres
    • presto
1.3.0

4 years ago

1.2.0

4 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago