Skip to main content

CLI wrapper around sqlglot

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlglot_cli-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

sqlglot_cli-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file sqlglot_cli-0.1.0.tar.gz.

File metadata

  • Download URL: sqlglot_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/23.5.0

File hashes

Hashes for sqlglot_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 14523d6102d131d2efaed36a615842bd6948ecbffa5c3de1f98019407614ca0a
MD5 1c37b152cb79bb55b62d0620381a223b
BLAKE2b-256 63addc2e868dddc3ef7f0c9d5874c52e8c38bf378336859c0a813ac377afbf74

See more details on using hashes here.

File details

Details for the file sqlglot_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sqlglot_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.7 Darwin/23.5.0

File hashes

Hashes for sqlglot_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96b3c537aa96bc4f6c570ac3e1f90fa231333f92afc68743bdd0620e5bf5cc6f
MD5 cf56cdacd84415b6dd501ae88e3d4f32
BLAKE2b-256 f9a3f57dc7f6f639c594eb460bd55018d1d523a84bb59dec4b83012c9f88a82c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page