skillfed

ipython-sql

RDBMS access via IPython

ipython-sql v0.5.0 387.7K downloads/30d#7,043 on PyPI1,797
Permissive license MIT DORMANT released

What it is and what it does

ipython-sql is a magic command extension for IPython and Jupyter notebooks that lets you write and execute SQL queries directly in notebook cells. It connects to any database supported by SQLAlchemy—PostgreSQL, MySQL, SQLite, Oracle, and others—using standard SQLAlchemy connection strings. Once connected, you can issue queries with %sql (single-line) or %%sql (multi-line) magic, and results are returned as objects you can iterate over, access by column name, or convert to Pandas DataFrames.

The package handles multiple simultaneous database connections, supports variable substitution and bind parameters, and lets you capture query results into Python variables for further analysis. It's designed for exploratory data work and ad-hoc querying in notebooks, where switching between SQL and Python would otherwise require separate tools or boilerplate connection code.

Use it for:

  • Exploratory data analysis in Jupyter: query a database and immediately plot or analyze results in the same notebook.
  • Prototyping SQL queries interactively without leaving the notebook environment.
  • Teaching SQL or databases in a classroom setting where students can write and test queries live.
  • Combining SQL queries with Python data processing: fetch data, transform it, and visualize it in one workflow.
  • Quick ad-hoc reporting from a database without setting up a separate reporting tool.

Worth the install?

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

Adds SQL magic commands to IPython and Jupyter notebooks, letting you query databases directly from cells using SQLAlchemy connection strings.

Yes, if you work regularly in Jupyter or IPython and need to query databases interactively. The low install friction and permissive license make it a low-risk addition. However, the dormant maintenance status (last release over a year ago, Alpha classification) means you should verify compatibility with your Python and IPython versions before relying on it for production workflows. No known security vulnerabilities.

Install

ipython-sql on PyPI

pip

pip install ipython-sql

uv

uv add ipython-sql

poetry

poetry add ipython-sql

Installing ipython-sql

Before you install

Low install friction with a pure-Python wheel and six runtime dependencies. Maintenance is dormant—last release was 2023-02-27, over a year ago, though the repository remains active with 1797 stars and no archived status.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install ipython-sql

In IPython or Jupyter:
%load_ext sql
%%sql postgresql://user:password@localhost/dbname
SELECT * FROM table LIMIT 5;

Requires IPython or Jupyter to be installed and running; database driver for your target database (e.g., psycopg2 for PostgreSQL) must be installed separately.

Verify before relying

  • Whether the package works with modern Python versions (3.9+) given its Alpha status and dormant maintenance.
  • Current compatibility with recent IPython and SQLAlchemy versions.
  • Whether all six runtime dependencies are actively maintained and free of vulnerabilities.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 6 — prettytable, ipython, sqlalchemy, sqlparse, six, ipython-genutils
Maintenance dormant — 1,264 days since the last release
Last repo commit
First released
Downloads 387,691/month — #7,043 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ipython_sql-0.5.0-py3-none-any.whl

Keywords: database, ipython, postgresql, mysql

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

Tags

sql in jupyter notebookipython database querysql magic commandquery postgresql from notebookinteractive sql shellsqlalchemy ipython integrationdatabase access jupyter
jupyter-integrationsql-query-toolinteractive-analysis

More Database packages