No project description provided
Project description
jupyter_anywidget_pglite
Jupyter anywidget
and magic for working with pglite
(single use postgres wasm build).
Install from PyPi as: pip install jupyter_anywidget_pglite
Usage:
- import package and magic:
%load_ext jupyter_anywidget_pglite
from jupyter_anywidget_pglite import pglite_panel
pg = pglite_panel()
# w = pglite_panel("example panel title)`
# w = pglite_panel(None, "split-bottom")`
# Headless mode (no HTML UI, works in Jupyter Lab, Jupyter Notebook, VS Code w/ Jupyter notebook support)
#from jupyter_anywidget_pglite import pglite_headless
#pg = pglite_headless()
# Inline display — display HTML UI as initialising code cell outpu
# Display will be updated with consequent queries
#from jupyter_anywidget_pglite import pglite_inline
#pg = pglite_inline()
This should open a panel in the right-hand sidebar (split-right
) by default:
Running queries on the database using IPython cell block magic %%pglite WIDGET_VARIABLE
:
%%pglite_magic pg
CREATE TABLE IF NOT EXISTS test (
id serial primary key,
title varchar not null
);
#----
%%pglite_magic pg
INSERT INTO test (title) VALUES ('dummy');
#----
%%pglite_magic pg
SELECT * FROM test;
Currently, it seems as if you can only run one instrcution at a time / per magic cell.
Having made a query onto the database via a magic cell, we can retrieve the response:
pg.response
Close the panel (i.e. "disconnect" the database):
# Either close the panel directly or run:
w.close()
TO DO
- currently the database is ephemeral / not persistent; add option to use browser storage;
- functions to nicely process the response from the database;
- options to display outputs in the panel;
- how to handle lots on inputs?
- button to clear input history;
- button to reset database;
- explore possibility of a JuptyerLab extension to load
pglite
"centrally" and then connect to the same instance from any notebook.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for jupyter_anywidget_pglite-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7055b556eb2b63426060192e675bf06b0e565e0a80c0ab8068d04a9703bb994b |
|
MD5 | 298ec0e05c88f938892267942deca061 |
|
BLAKE2b-256 | 053fcb3679c20f2b6471e8bc5fe19151942ae47e373d4a773fabf9cbfb96beed |
Close
Hashes for jupyter_anywidget_pglite-0.0.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ce5a7f52c9fcb6701b4f3f36eb2a3dcfbefb0eabb1a6fb274f569bb605bfc6b |
|
MD5 | 9832f02846f77297e0069b676d15d550 |
|
BLAKE2b-256 | db073f9c9e6e3780b089c5eb014558d632311cffc213a0510240895111a9d8ed |