{"id":18400647,"url":"https://github.com/databricks/databricks-sql-cli","last_synced_at":"2025-04-07T06:33:38.385Z","repository":{"id":37793399,"uuid":"439714345","full_name":"databricks/databricks-sql-cli","owner":"databricks","description":"CLI for querying Databricks SQL","archived":false,"fork":false,"pushed_at":"2023-11-24T12:02:21.000Z","size":4029,"stargazers_count":39,"open_issues_count":26,"forks_count":12,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-03T00:58:59.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/databricks.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-18T21:02:41.000Z","updated_at":"2025-03-01T11:25:40.000Z","dependencies_parsed_at":"2024-06-21T18:54:53.841Z","dependency_job_id":"9a93a9dc-3570-4c6d-a412-efbf8fe5d543","html_url":"https://github.com/databricks/databricks-sql-cli","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/databricks%2Fdatabricks-sql-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/databricks","download_url":"https://codeload.github.com/databricks/databricks-sql-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247607766,"owners_count":20965945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T02:35:39.338Z","updated_at":"2025-04-07T06:33:33.371Z","avatar_url":"https://github.com/databricks.png","language":"Python","readme":"# Introduction\n\nDatabricks SQL CLI is a command line interface (CLI) for [Databricks SQL](https://databricks.com/product/databricks-sql) that can do auto-completion and syntax highlighting, and is a proud member of the dbcli community.\n\n![](https://github.com/databricks/databricks-sql-cli/raw/main/dbsqlcli-demo.gif?raw=True)\n\n# Quick Start\n\n### Install via `pip`\n\nYou'll need Python 3.7 or newer.\n\n```bash\npython3 -m pip install databricks-sql-cli\n```\n\nYou can now run `dbsqlcli` from your terminal.\n\n## Authentication\n\nTo connect with SQL Endpoints `dbsqlcli` needs the host name and http path from the [connection details](https://docs.databricks.com/integrations/bi/jdbc-odbc-bi.html#get-connection-details-for-a-sql-warehouse) screen in Databricks SQL and a [personal access token](https://docs.databricks.com/dev-tools/api/latest/authentication.html#token-management). You can provide these to `dbsqlcli` as command line arguments, by setting environment variables, or by writing them into the `[credentials]` section of the `dbsqlclirc` file (see below).\n\n\n## Config\n\nA config file is automatically created at `~/.dbsqlcli/dbsqlclirc` at first launch (run `dbsqlcli`). See the file itself for a description of all available options.\n\n\n## Run a query\n\n``` bash\n$ dbsqlcli -e 'select id, name from minifigs LIMIT 10'\n```\n\n## Run a .sql file\n\n```bash\n$ dbsqlcli -e query.sql\n```\n\n## Run a .sql file and save to CSV\n\n```bash\n$ dbsqlcli -e query.sql \u003e output.csv\n```\n\n## REPL\n\n``` bash\n$ cd \u003cdirectory containing dbsqlcli binary\u003e\n$ ./dbslqcli [\u003cdatabase_name\u003e]\n```\n\nRun the `help;` command to see a list of shortcuts\n\n# Features\n\n- Auto-completes as you type for SQL keywords as well as tables and columns in the database.\n- Syntax highlighting.\n- Smart-completion will suggest context-sensitive completion.\n    - `SELECT * FROM \u003ctab\u003e` will only show table names.\n    - `SELECT * FROM users WHERE \u003ctab\u003e` will only show column names.\n- Pretty prints tabular data and various table formats.\n- Some special commands. e.g. Favorite queries.\n- Alias support. Column completions will work even when table names are aliased.\n\n# Usages\n\n```bash\n$ dbsqlcli --help\nUsage: dbsqlcli [OPTIONS] [DATABASE]\n\n  A DBSQL terminal querying client with auto-completion and syntax\n  highlighting.\n\n  Examples:\n    - dbsqlcli\n    - dbsqlcli my_database\n\nOptions:\n  -e, --execute TEXT   Execute a command (or a file) and quit.\n  --hostname TEXT      Hostname  [env var: DBSQLCLI_HOST_NAME]\n  --http-path TEXT     HTTP Path  [env var: DBSQLCLI_HTTP_PATH]\n  --access-token TEXT  Access Token  [env var: DBSQLCLI_ACCESS_TOKEN]\n  --clirc FILE         Location of clirc file.\n  --table-format TEXT  Table format used with -e option.\n  --help               Show this message and exit.\n```\n\n\n# Contributions\n\nWe use [Poetry](https://python-poetry.org/docs/) for development. Follow the instructions to install Poetry on your system. \n\n1. Clone this repository\n2. `poetry install` will install its dependencies\n3. `poetry shell` will activate the local virtual environment\n4. `python app.py` will run `dbsqlcli` incorporating any of your local changes\n\n# Credits\n\nHuge thanks to the maintainers of https://github.com/dbcli/athenacli upon which this project is built.\n\n# Similar projects\n\nThe [DBCLI](https://github.com/dbcli) organization on Github maintains CLIs for numerous database platforms including MySQL, Postgres, and MSSQL. \n\n- https://github.com/dbcli/mycli\n- https://github.com/dbcli/pgcli\n- https://github.com/dbcli/mssql-cli\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabricks%2Fdatabricks-sql-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatabricks%2Fdatabricks-sql-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatabricks%2Fdatabricks-sql-cli/lists"}