Metadata-Version: 2.1
Name: sqlglot-cli
Version: 0.1.0
Summary: CLI wrapper around sqlglot
Author: Michael Harris
Author-email: mharris@definite.app
Requires-Python: >=3.12,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Provides-Extra: rich
Provides-Extra: rs
Requires-Dist: rich (>=13.9.3,<14.0.0) ; extra == "rich"
Requires-Dist: sqlglot (>=25.28.0,<26.0.0)
Requires-Dist: sqlglotrs (>=0.2.13,<0.3.0) ; extra == "rs"
Requires-Dist: typer (>=0.12.5,<0.13.0)
Description-Content-Type: text/markdown

# sqlglot-cli

CLI wrapper around [sqlglot](https://github.com/tobymao/sqlglot).

## Installation

```sh
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

```sh
# 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
```

