Registry / database / snowsql-formatter

snowsql-formatter

JSON →
library1.1.0jsnpmunverified

A fork of sql-formatter-plus that adds Snowflake-specific syntax support (JSON references, etc.) for formatting/pretty-printing SQL queries. Currently at v1.1.0 with low release cadence. Supports Standard SQL, N1QL, DB2, and PL/SQL dialects. Provides placeholder replacement, configurable indent/uppercase, and works in Node.js and browsers. Ships TypeScript type definitions. The primary differentiator is its Snowflake focus, though the official Snowflake dialect is still pending.

npm install snowsql-formatter
INSTALL
IMPORT
SIG · SNOWSQL-FORMATTER
S
snowsql-formatter
databasejavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sqlFormatter
import sqlFormatter from 'snowsql-formatter'
import { sqlFormatter } from 'snowsql-formatter'
Default export, not named.
format
import sqlFormatter from 'snowsql-formatter'; sqlFormatter.format('SELECT *')
import { format } from 'snowsql-formatter'
Use default export then call .format method.
sqlFormatter
const sqlFormatter = require('snowsql-formatter');
const { sqlFormatter } = require('snowsql-formatter')
CommonJS require returns the default export directly.

Formats a simple SQL query with uppercase keywords and indentation.

import sqlFormatter from 'snowsql-formatter'; const formatted = sqlFormatter.format('SELECT id, name FROM users WHERE age > 18 ORDER BY name', { language: 'sql', indent: ' ', uppercase: true, linesBetweenQueries: 1 }); console.log(formatted); // Output: // SELECT // id, // name // FROM // users // WHERE // age > 18 // ORDER BY // name
Debug
Known issues
gotchadefault export is a function, not an object with 'format' method
fix
Use `import sqlFormatter from 'snowsql-formatter'` and call `sqlFormatter.format(...)` directly.
affects: >=1.0.0
breakingIn v1.0.0, the package was renamed from sql-formatter-plus to snowsql-formatter; old import paths break.
fix
Update imports to use 'snowsql-formatter' and reinstall.
affects: 1.0.0
gotchaNo official 'snowsql' dialect yet; use 'sql' dialect for generic formatting.
fix
Use `language: 'sql'` until a dedicated SnowSQL dialect is released.
affects: <=1.1.0
gotchaPlaceholder replacement parameters must be strings (e.g., "'bar'") not raw values.
fix
Always quote values in params object: `params: {foo: "'bar'"}`
affects: >=1.0.0
deprecatedThe `params` option for placeholders is deprecated in favor of new syntax? (No confirmation in docs).
fix
Still works in v1.1.0, but consider using alternatives like template literals.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: sqlFormatter.format is not a function
Importing named export instead of default.
fix
Use `import sqlFormatter from 'snowsql-formatter'` (no curly braces).
Module not found: Can't resolve 'snowsql-formatter'
Package not installed or old npm cache.
fix
Run `npm install snowsql-formatter` or clear cache with `npm cache clean --force`.
Error: Unsupported SQL dialect: snowsql
Passing 'snowsql' as language, but it's not implemented yet.
fix
Use one of: 'sql', 'n1ql', 'db2', 'pl/sql'.
SyntaxError: Unexpected token (in JSON params)
Params values must be strings with inner quotes for SQL string literals.
fix
Use `params: {foo: "'bar'"}` instead of `params: {foo: 'bar'}`.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Meta
1
Resources
snowsql-formatter — npm install snowsql-formatter · libregistry