SQLViz
SQLViz is a Python library that allows you to query SQL databases and visualize the results directly using Plotly charts.
Installation
pip install sqlviz
Features
- Query any SQL database supported by SQLAlchemy.
- Generate charts (bar, line, scatter, etc.) from SQL queries.
- CLI utility to quickly visualize SQL results.
- Auto-detect x/y columns when not provided.
CLI Usage
You can use SQLViz from the command line to generate charts directly from your database.
Syntax
sqlviz-cli --db-uri <DATABASE_URI> --sql "<SQL_QUERY>" --chart-type <CHART_TYPE> [--x <X_COLUMN>] [--y <Y_COLUMN>] [--show False]
Parameters
--db-uri: SQLAlchemy database URI (e.g.,sqlite:///mydata.db).--sql: SQL query to fetch data.--chart-type: Type of chart (bar,line,scatter, etc.).--x: (Optional) Column name for X-axis.--y: (Optional) Column name for Y-axis.--show: Whether to display the chart immediately (default: True).
Example
sqlviz-cli --db-uri sqlite:///test.db --sql "SELECT * FROM t" --chart-type bar --x x --y y --show False
This will generate a bar chart from the t table in test.db, mapping x to X-axis and y to Y-axis, without displaying it immediately.
Python Usage
from sqlviz.core import visualize_sql_cli
fig = visualize_sql_cli(
db_uri="sqlite:///test.db",
sql="SELECT * FROM t",
chart_type="bar",
show=True,
kwargs_str='{"x": "x", "y": "y"}'
)
fig is a Plotly Figure object and can be further customized or saved.
License
MIT License
Metadata
Release files for sqlviz 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqlviz-0.0.1.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlviz-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / sqlviz-0.0.1.tar.gz
| Download URL | sqlviz-0.0.1.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
753d025ce15e0f4a5aa6ef59f53b4350aab0fffca25c38d7dacbc7975921a59c
|
|
BLAKE2b-256 checksum How to use checksums |
b030eafd847e511c321d9cc1925361b46a741c4c84e265c8f60ac2452d979e29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / sqlviz-0.0.1-py3-none-any.whl
| Download URL | sqlviz-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f5681df3c24a06d62adaa6ef18c92a1cb1677ac74bc5a3dc6decc93891642c0
|
|
BLAKE2b-256 checksum How to use checksums |
6d496d07e7329ba93ad35bf85baef56a5835a1c445e5a19d49f6e044e8467651
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|