JupySQL (version 0.11.1) enhances SQL interaction within Jupyter notebooks, allowing users to connect to various databases and execute queries directly using IPython magic commands. It supports advanced features like variable interpolation, caching, and data visualization. The project is actively maintained with frequent releases, typically every few weeks.
pip install jupysqlVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load the JupySQL extension, connect to an in-memory SQLite database, create a table, insert data, and execute a simple SQL query using the `%sql` and `%%sql` magic commands.
Update your `jupysql.configure` calls: - Replace `display_limit` with `result_limit`. - For style configuration, use `from jupysql import plot; plot.configure_styles(...)`.
Always include `%load_ext sql` as the first line in your Jupyter notebooks or when starting an interactive IPython session where you intend to use JupySQL magic commands.
When embedding Python variables into SQL queries, use the double curly brace syntax: `my_var = 'Sales'; %sql SELECT * FROM employees WHERE department = '{{my_var}}'`.