Skip to content

mharrisb1/sqlglot-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqlglot-cli

CLI wrapper around sqlglot.

Installation

pipx install sqlglot-cli

# or with sqlglotrs
pipx install 'sqlglot-cli[rs]'

# or with rich terminal
pipx install 'sqlglot-cli[rich]'

# or with both
pipx install 'sqlglot-cli[rs,rich]'

Usage

Important

All output is written to stdout

# read from file
sqlglot-cli transpile foo.sql --read postgres --write clickhouse --pretty

# or use stdin
cat foo.sql | sqlglot-cli transpile - --read postgres --write clickhouse --pretty

# pipe to your heart's desire to incorporate into workflows
cat examples/postgres__ctes.in.sql |
sqlglot-cli optimize - -d postgres --all |
sqlglot-cli transpile - -r postgres -w snowflake |
sqlglot-cli optimize - -d snowflake --all |
sqlfluff fix - --dialect snowflake

Releases

No releases published

Languages