SQL

Airsequel’s SQL workbench lets you execute arbitrary SQL queries on your SQLite database.
Image without caption
As seen in the screenshot above, airsequel provides OpenAI integration for query generation. Moreover, you can work on multiple queries simultaneously by creating multiple tabs:
Image without caption
As seen in the pictures above, the query can be saved as a new or existing view using the buttons on the bottom right. By default, the view will now appear in the “tables” tab, but a special “views” tab can be enabled in the settings:
Image without caption
Check out the pricing page for all limitations of the Free edition.


Extra Types for SQLite

In order to support more elaborate types than just the basic SQL types, we came up with a specification on how to extend SQLite with extra datatypes in a standard conformant way.
The basic idea is to use suffixes like e.g. TEXT_EMAIL to specify more refined types. Since SQLite’s type affinity will treat this as a TEXT column, it works in a backwards compatible way.
For more details check out the full specification in following repo: github.com/Airsequel/SQLite-Extra-Types
When editing entries via the GUI, Airsequel will provide specialized input fields for the given type. For instance, “color” columns can be edited using a color picker:
Image without caption

Interactive Editing

Airsequel provides comprehensive interactive editing capabilities. The most common operations are presented in the list below:
Change the name or description of a database
Create a table
Rename / Delete / Export a table
Change table description
Create a column
Delete / Rename / Hide (collapse) column
Set all entries of column to the default value
Reorder columns
Delete an arbitrary set of rows
Create a row
Edit a cell

SQL API Usage

The SQL API is only available in the Enterprise Edition.
shell
curl \ --data '{ "query": "select name, height_in_cm from characters" }' \ --header 'Content-Type: application/json' \ http://localhost:4185/dbs/avatar_characters/sql
yields:
json
{ "rows": [ { "name": "Aang", "height_in_cm": 137 }, { "name": "Katara", "height_in_cm": 145 } ], "runtime": { "real": 0.000, "user": 0.000214, "sys": 0.000090 } }

Useful SQL Snippets

Basics

Rename a column
Count lines of text in a column
Check if all values in a group are the same
Get ISO 8601 timestamp with millisecond precision
Create table with an automatically set timestamp column
Select all rows of a table except the first one
Only update value if it’s not NULL
Include example data in an SQL query
Delete duplicate rows
Update several specific fields in a column at once

JSON

Extract value from JSON object
Merge a column of JSON objects
Extract a URL from a column and store it in another JSON column

Generation

Get a random number between 0 and 1 with 2 decimal places
Generate a table with numbers from 1 to 10
Generate a table random_data with x rows of random entries
Add a “row number” column (starting from 1)
Set a random date time between 2000-01-01 and 2024-01-20 for first 10 items

Advanced

Get all possible sub-paths for a column with paths / urls
Split a multiline cell into one line per row
Get the last NOT NULL value in a group
Automatically set a random id after inserting a row
Convert table of cumulative values to delta values

Powered by Notaku