Skip to main content

Jupyter kernel for ggsql - SQL extension for declarative data visualization

Project description

ggsql Jupyter Kernel

A Jupyter kernel for executing ggsql queries with rich inline Vega-Lite visualizations.

Overview

The ggsql Jupyter kernel enables you to run ggsql queries directly in Jupyter notebooks, with automatic rendering of visualizations using Vega-Lite. It maintains a persistent DuckDB session across cells, allowing you to build up datasets and create visualizations interactively.

Features

  • Execute ggsql queries in Jupyter notebooks
  • Rich visualizations with Vega-Lite rendered inline
  • Persistent DuckDB session across cells
  • Pure SQL support with HTML table output
  • Grammar of Graphics syntax for declarative visualization

Installation

Prerequisites

  • Jupyter Lab or Notebook installed

Option 1: Install from PyPI (Recommended)

The easiest way to install the ggsql kernel is from PyPI. This provides pre-built binaries for Linux, macOS, and Windows.

Using pip:

pip install ggsql-jupyter
ggsql-jupyter --install

Using uv:

uv tool install ggsql-jupyter
ggsql-jupyter --install

The --install flag registers the kernel with Jupyter. It automatically detects and respects your current environment (virtualenv, conda, uv, etc.).

Option 2: Install from crates.io

Requires a Rust toolchain:

cargo install ggsql-jupyter
ggsql-jupyter --install

Option 3: Download Pre-built Binary

Pre-built binaries are available from GitHub Releases:

Platform Binary
Linux (x86_64) ggsql-jupyter-linux-x64
Linux (ARM64) ggsql-jupyter-linux-arm64
macOS (Intel) ggsql-jupyter-macos-x64
macOS (Apple Silicon) ggsql-jupyter-macos-arm64
Windows (x64) ggsql-jupyter-windows-x64.exe

After downloading, make it executable and install:

chmod +x ggsql-jupyter-*
./ggsql-jupyter-linux-x64 --install

On Windows (PowerShell):

.\ggsql-jupyter-windows-x64.exe --install

Option 4: Build from Source

Requires a Rust toolchain. From the workspace root:

cargo build --release --package ggsql-jupyter
./target/release/ggsql-jupyter --install

Installation Flags

  • --install: Install the kernel (default: user install)
  • --install --user: Explicitly install for current user
  • --install --sys-prefix: Install into sys.prefix (for conda envs)

Verify Installation

jupyter kernelspec list

You should see ggsql in the list of available kernels.

Usage

Start Jupyter

jupyter lab
# or
jupyter notebook

Create a ggsql Notebook

  1. In Jupyter, click "New" and select "ggsql" from the dropdown
  2. Start writing ggsql queries!

Example Queries

Simple Point Plot

SELECT 1 as x, 2 as y, 'A' as category
UNION ALL
SELECT 2, 4, 'A'
UNION ALL
SELECT 3, 3, 'B'

VISUALISE x, y, category AS color
DRAW point

Time Series

SELECT
    '2024-01-01'::DATE + INTERVAL (n) DAY as date,
    n * 10 as revenue
FROM generate_series(0, 30) as t(n)

VISUALISE date AS x, revenue AS y
DRAW line
SCALE x
  SETTING type => 'date'
LABEL title => 'Revenue Growth', x => 'Date', y => 'Revenue ($)'

Multi-Layer Plot with Global Mapping

SELECT x, x*x as y, x*x*x as z
FROM generate_series(1, 10) as t(x)

VISUALISE x AS x
DRAW line
  MAPPING y AS y
DRAW line
  MAPPING z AS y
LABEL title => 'Polynomial Functions'

Pure SQL (Data Tables)

SELECT * FROM (VALUES (1, 'a'), (2, 'b'), (3, 'c')) AS t(id, name)

This will display as an HTML table without visualization.

Building Up Data Across Cells

Cell 1:

CREATE TABLE products AS
SELECT * FROM (VALUES
  (1, 'Widget', 10.99),
  (2, 'Gadget', 24.99),
  (3, 'Doohickey', 5.99)
) AS t(id, name, price)

Cell 2:

SELECT * FROM products
VISUALISE name AS x, price AS y
DRAW bar
LABEL title => 'Product Prices', y => 'Price ($)'

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

ggsql_jupyter-0.3.0.tar.gz (941.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

ggsql_jupyter-0.3.0-py3-none-win_amd64.whl (15.5 MB view details)

Uploaded Python 3Windows x86-64

ggsql_jupyter-0.3.0-py3-none-manylinux_2_28_x86_64.whl (19.1 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

ggsql_jupyter-0.3.0-py3-none-manylinux_2_28_aarch64.whl (17.0 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

ggsql_jupyter-0.3.0-py3-none-macosx_11_0_arm64.whl (15.1 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

ggsql_jupyter-0.3.0-py3-none-macosx_10_12_x86_64.whl (17.4 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file ggsql_jupyter-0.3.0.tar.gz.

File metadata

  • Download URL: ggsql_jupyter-0.3.0.tar.gz
  • Upload date:
  • Size: 941.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ggsql_jupyter-0.3.0.tar.gz
Algorithm Hash digest
SHA256 7def9085b1d00086fad83f0af1bbff9152a2b20887684d361cc5573be141b127
MD5 9a8e4a109b55c565f5eb0dc4ce2b8d0c
BLAKE2b-256 5c1c593395fcaf64f1e9289287dd2fbf5fc79e76aefe5276776efe047db870a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggsql_jupyter-0.3.0.tar.gz:

Publisher: release-jupyter.yml on posit-dev/ggsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ggsql_jupyter-0.3.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: ggsql_jupyter-0.3.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 15.5 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ggsql_jupyter-0.3.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 703c6d49b917c1ed3c45a57a8ded3ec26f38b0dd39d3ff7a6fc76fa4a07e77eb
MD5 d6c92011aa2553ae5f2ad608c2bfdf69
BLAKE2b-256 872f2ee4ff8c1a5998718980b46e909e248db47d41d5d8775a9df2d7bc2deb1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggsql_jupyter-0.3.0-py3-none-win_amd64.whl:

Publisher: release-jupyter.yml on posit-dev/ggsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ggsql_jupyter-0.3.0-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for ggsql_jupyter-0.3.0-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5b5a0d82b86415aeb680b2263577368cb669bab69453888308f181055eec55ed
MD5 6552042f44c584a5a477af6ceebb6498
BLAKE2b-256 d48facda14bfb77aebf9235587fefe19b3235b28dead3f4bb66d818294433387

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggsql_jupyter-0.3.0-py3-none-manylinux_2_28_x86_64.whl:

Publisher: release-jupyter.yml on posit-dev/ggsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ggsql_jupyter-0.3.0-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for ggsql_jupyter-0.3.0-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 7e72a462241eef3447190684885c19786631a67646d362b4ce3b491b2cd9c800
MD5 4ca550b40a3f718b88cb70d30eaafdee
BLAKE2b-256 1834554455aec33958eda3be9840fa66fc4be51f7bd1879178972857bce6cbac

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggsql_jupyter-0.3.0-py3-none-manylinux_2_28_aarch64.whl:

Publisher: release-jupyter.yml on posit-dev/ggsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ggsql_jupyter-0.3.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ggsql_jupyter-0.3.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5ed696bed520c82621a4e4791173c4d341120878215bd6ff52ee69870a4f9bb
MD5 9120d497ad7b334d125dd7b2c0b6986f
BLAKE2b-256 91901352326e6f0f028490a1f56dac5daa7d10647d23f80d470dce6102326b87

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggsql_jupyter-0.3.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release-jupyter.yml on posit-dev/ggsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ggsql_jupyter-0.3.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for ggsql_jupyter-0.3.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 80cd128167c64b612e9b74b521f12b2b46df6d7f0edea593e4dbdc61ef0edf96
MD5 484db586466351e61f214ed05578a3cb
BLAKE2b-256 4b95ea0126c5128eafe6f3a3dbefa6837bb16e57a3c104a16ed2da751b083455

See more details on using hashes here.

Provenance

The following attestation bundles were made for ggsql_jupyter-0.3.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: release-jupyter.yml on posit-dev/ggsql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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