Xeus SQLite Environment

This notebook describes and creates a Xeus SQLite environment in Nextjournal. The xeus-sqlite Jupyter kernel is still under heavy development, but is a usable way to quickly create or interact with an SQLite database file.

Note that currently it seems each SQLite command must be in its own cell—semicolons do not allow multiple commands.

Setup

Install

conda install -c conda-forge xeus-sqlite
49.5s
Xeus SQLite (Bash in Python)

Test

Load existing (blank) database.

touch /example_db.db
0.7s
Bash in Sqlite
Xeus SQLite
%LOAD example_db.db
0.0s
Sqlite
Xeus SQLite
CREATE TABLE players (Name STRING, Class STRING, Level INTEGER)
0.0s
Sqlite
Xeus SQLite
INSERT INTO players (Name, Class, Level) VALUES ("Martin Splitskull", "Warrior", 3)
0.0s
Sqlite
Xeus SQLite
INSERT INTO players (Name, Class, Level) VALUES ("Sir Wolf", "Cleric", 2)
0.0s
Sqlite
Xeus SQLite
INSERT INTO players (Name, Class) VALUES ("Sylvain, The Grey", "Wizard")
0.0s
Sqlite
Xeus SQLite
SELECT (Name) FROM players
0.0s
Sqlite
Xeus SQLite
Name
Martin Splitskull
Sir Wolf
Sylvain, The Grey
SELECT SUM (Level) FROM players
0.0s
Sqlite
Xeus SQLite
SUM (Level)
5
%TABLE_EXISTS players
0.0s
Sqlite
Xeus SQLite
The table players exists.
%TABLE_EXISTS npcs
0.0s
Sqlite
Xeus SQLite
The table npcs doesn't exist.
%GET_INFO
0.0s
Sqlite
Xeus SQLite
Magic header string: SQLite format 3 Page size bytes: 4096 File format write version: 1 File format read version: 1 Reserved space bytes: 0 Max embedded payload fraction 64 Min embedded payload fraction: 32 Leaf payload fraction: 32 File change counter: 4 Database size pages: 2 First freelist trunk page: 0 Total freelist trunk pages: 0 Schema cookie: 1 Schema format number: 4 Default page cache size bytes: 0 Largest B tree page number: 0 Database text encoding: 1 User version: 0 Incremental vaccum mode: 0 Application ID: 0 Version valid for: 4 SQLite version: 3030001

Create new DB.

%CREATE potato.db
0.0s
Sqlite
Xeus SQLite
CREATE TABLE potaters(production INTEGER)
0.0s
Sqlite
Xeus SQLite
INSERT INTO potaters (production) VALUES (7)
0.0s
Sqlite
Xeus SQLite
select * from potaters
0.0s
Sqlite
Xeus SQLite
production
7

?

%DELETE
0.0s
Sqlite
Xeus SQLite
SELECT * FROM potaters
0.0s
Sqlite
Xeus SQLite
production
7
Runtimes (2)
Runtime Languages (1)