Package Exports
- dbt-formatter
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dbt-formatter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
DBT Formatter
Install
npm install -s dbt-formatterUsage
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:
| Option | Default | Description |
|---|---|---|
| sql | default |
The sql dialect you want to use, currently only default is available |
| indent | 2 |
How many spaces you want an indentation to be |
| upper | false |
Formats sql reserved words to be uppercase when set to true |
| newline | false |
Appends a new line at the end of the formatted sql string |
| lowerWords | false |
Lowercases all words as identified by the tokenizer |
| allowCamelcase | true |
Allows column names to be camelcased |
Development
NPM scripts
npm test: Run test suitenpm start: Runnpm run buildin watch modenpm run build: Generate bundles and typings, create docsnpm run lint: Lints codenpm run package: Package dbt-formatter as a binary
Roadmap
- Add more sql dialects:
- snowflake
- redshift
- bigquery
- postgres
- presto