skillfed

jupysql

Better SQL in Jupyter

jupysql v0.11.1 156.1K downloads/30d#10,793 on PyPI848
Permissive license Active released

What it is and what it does

JupySQL is a Jupyter/IPython extension that lets you write and execute SQL queries directly in notebook cells using `%sql` (single-line) and `%%sql` (multi-line) magic commands. It acts as a SQL client for Jupyter, bridging the gap between notebook Python code and external databases. The package depends on sqlalchemy for database abstraction, sqlparse for SQL parsing, jinja2 for templating, and several IPython utilities to integrate seamlessly into the notebook environment.

The package is designed to make exploratory data analysis and SQL development more natural in notebooks by eliminating the need to switch between tools. It supports multiple database backends (PostgreSQL, MySQL, DuckDB, and others via SQLAlchemy) and offers features like Pandas integration for downstream Python processing, SQL composition helpers, and memory-efficient plotting of large result sets. It is currently in Alpha status (Development Status 3), indicating active development but potential API changes.

Use it for:

  • Run ad-hoc SQL queries against production or analytical databases directly from a Jupyter notebook without leaving your analysis environment.
  • Compose and debug complex SQL queries using templating and composition features, then pass results to Pandas for further Python-based analysis.
  • Visualize query results without loading entire datasets into memory by using the built-in plotting capabilities.
  • Prototype data pipelines in notebooks by mixing SQL queries with Python logic in a single, reproducible document.
  • Explore DuckDB or other SQLAlchemy-supported databases interactively without writing boilerplate connection code.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Adds SQL execution to Jupyter and IPython notebooks via `%sql` and `%%sql` magic commands, letting you query databases directly in cells and integrate results with Python.

Yes, if you work regularly in Jupyter and need to query databases. Low install friction, active maintenance, permissive license, and no known vulnerabilities make it a straightforward addition. The Alpha status means the API may shift, but 848 stars and ongoing commits suggest it is stable enough for exploratory and development work. Not necessary if you already have a preferred SQL IDE or if your workflow rarely involves database queries from notebooks.

Install

jupysql on PyPI

pip

pip install jupysql

uv

uv add jupysql

poetry

poetry add jupysql

Installing jupysql

Before you install

Low install friction with a pure-Python wheel. Active maintenance (last commit 2026-06-29) and 848 repository stars suggest ongoing community use. Ten runtime dependencies are manageable and well-established (sqlalchemy, ipython, jinja2, sqlparse, prettytable, sqlglot, and others).

License in practice

Permissive Apache license allows commercial and private use without restriction, making it suitable for any deployment context.

Quickstart

pip install jupysql

In Jupyter:
%load_ext sql
%sql SELECT * FROM table_name

Requires Jupyter or IPython environment; a database connection string must be configured before queries will execute.

Verify before relying

  • Whether all advertised integrations (Pandas, DuckDB, plotting) are included in version 0.11.1 or require additional setup.
  • Minimum Python version and compatibility with recent Jupyter/IPython releases.
  • Performance characteristics when querying large datasets despite the advertised memory-efficient plotting.

Package facts

License not declared (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 10 — prettytable, ipython, sqlalchemy, sqlparse, ipython-genutils, jinja2, sqlglot, importlib-metadata, jupysql-plugin, ploomber-core
Maintenance actively maintained — 507 days since the last release
Last repo commit
First released
Downloads 156,088/month — #10,793 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: jupysql-0.11.1-py3-none-any.whl

Keywords: database, ipython, postgresql, mysql, duckdb

Development Status :: 3 - AlphaEnvironment :: ConsoleLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3Topic :: DatabaseTopic :: Database :: Front-Ends

Tags

sql in jupyter notebooksipython sql magicquery databases from jupytersql jupyter integrationrun sql in notebooksjupyter database clientsql magic commands
jupyter-extensionsql-clientnotebook-integration

More Database packages