A minimal CLI tool for running SQL queries on Databricks
Project description
dbsql-command-line
A minimal CLI tool for running SQL queries on Databricks.
Installation
pip install dbsql-command-line
Setup
Create a .env file in your working directory with the following variables:
DATABRICKS_TOKEN=your_databricks_access_token
DATABRICKS_SERVER_HOSTNAME=your_databricks_server_hostname
DATABRICKS_HTTP_PATH=your_databricks_http_path
DATABRICKS_CATALOG=your_databricks_catalog
DATABRICKS_SCHEMA=your_databricks_schema
Usage
Run SQL queries directly from the command line:
dbsql "SHOW TABLES;"
dbsql "DESCRIBE TABLE <table_name>;"
dbsql "SELECT * FROM <table_name> LIMIT 3;"
The results are returned in JSON format.
Examples
Show all tables in the current catalog/schema:
dbsql "SHOW TABLES;"
Describe the structure of a specific table:
dbsql "DESCRIBE TABLE my_table;"
Query data from a table:
dbsql "SELECT * FROM my_table LIMIT 3;"
Requirements
- Python 3.8 or higher
- Access to a Databricks workspace with appropriate credentials
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbsql_command_line-0.1.0.tar.gz.
File metadata
- Download URL: dbsql_command_line-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cdeebc5d1bbdc90c5eecb59b067056caa914b84b14484a261df98ddf51dba59c
|
|
| MD5 |
d4679b740667d212ce2bc67ab368fb94
|
|
| BLAKE2b-256 |
6dc79f0993d38ace2e944541ef81d656c895d7d435d16640723e8c0073e40da5
|
File details
Details for the file dbsql_command_line-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dbsql_command_line-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc55b3269347dc3bf1d9a012e43ede964241a4bbd738e587f3bfc7d310053e99
|
|
| MD5 |
1fc08d5562f29512caaa908eb008d56c
|
|
| BLAKE2b-256 |
242e22f44f88dd33d69cfaa7eb9782fa87f68f75effae20724f8eef14ce855ee
|