densa

Studio

Explore data as it arrives.

densa Studio opens Parquet and CSV files, WebSocket streams and Arrow Flight services and lets you explore them at once: grids that keep up as rows come, SQL over all of them, run again as they change, and a chart of the result.

Version 0.1, experimental: an open-source application built on densa, installed from its repository.

Install and run Every option
Recorded with --sample, --live and a query of the sensors above their site's alarm in each region: each sensor's latest reading joined to its site, the last minute counted per second, and the query run again each second.

01 — Install

One command, then open anything.

You need Rust 1.94 or later and a GPU with Vulkan, Metal, DirectX 12 or OpenGL. Studio is tested on Linux, macOS and Windows.

terminal
cargo install --locked --git https://github.com/densa-rs/densa-studio
# sample data, made on your machine
densa-studio --sample
# your own files, streams and Flight services
densa-studio trips.parquet zones.csv
densa-studio "wss://example.com/readings#key=sensor"
densa-studio "grpc://localhost:50051#tables"

Or from a clone of the repository: cargo run --release -- trips.parquet. Files and URLs can also be typed into the box at the top of the window, and files dropped on it.

The sample

  • requests: a million web requests in a Parquet file, written to your cache folder the first time
  • sites: six sites with their region, height and alarm temperature, in a CSV file
  • recent: a local stream of 500 sensors, every reading of the last minute, counted per second
  • readings: the same sensors, the latest reading of each, joined to its site
  • tables: a local Flight SQL service's list of tables, which Enter opens

02 — What it does

Every source a table, every table live.

Each file, stream and Flight result fills a grid of its own and is a table for SQL, named at the start of its tab's title. Tabs and panels can be dragged into other groups or split beside them, and the arrangement is there again the next time the same files and URLs open (--fresh starts from the default one).

Files that open as they load

CSV and Parquet files open in tabs of their own, from the command line, the box at the top of the window, or dropped on it. Rows appear while the rest is read, and a query sees each file as far as it has loaded.

  • Click a column title to sort; drag a column's edge to resize it
  • A Parquet file whose rows take more than 1 GB uncompressed is not loaded (any Parquet file with --paged): it opens at once and the grid reads only the rows it shows, from anywhere in the file; a click on a title sorts it, the first sort by a column making a sorted copy of the file in the temporary folder (the status bar counts the seconds), and the row title gives back the file's order; SQL reads the file itself, so filter and sum it there, sorts spilling to disk past 2 GB
  • Select rows with the mouse or keyboard and copy them as tab-separated text, for a spreadsheet
  • Each file is a table named after it, in lower case with anything but letters and digits made _, and its tab starts with that name: trips_2024 · Trips 2024.parquet
  • A word SQL reserves gets a _ (select.csv is select_), and a name already taken a number (trips_2)
  • A row column numbers each file's rows (row_ if it has a row column; SQL does not see it for a file read a page at a time)
query.sql
-- trips.parquet and zones.csv, by their table names
SELECT zones.borough, count(*) AS trips, avg(trips.fare) AS fare
FROM trips JOIN zones ON trips.zone = zones.id
GROUP BY 1
ORDER BY 2 DESC

SQL over everything, charted as it changes

The SQL panel runs a query over every open table with Apache DataFusion and shows the result as it is computed. The Chart tab beside it puts the result's first column across and each number column after it in a pane of its own, up to four; a line of millions of rows costs a frame about the chart's width, not its rows.

  • Live, or --live, runs the query again each second while its sources change; the result updates in place
  • A first column of text makes a bar chart: a bar for each row, named under it
  • Selecting a row of the result marks it on the chart; the wheel zooms and a drag pans
  • Type a file name beside the query and press Enter to save the result as Parquet or CSV, as the grid shows it; a file already there is never written over
  • Queries only read: no source is ever changed
A query over the last minute of readings, run again each second, and its chart.

Streams that keep up

A ws:// or wss:// URL opens a WebSocket stream in a tab that keeps up as rows come. JSON messages are read with the columns of the first one, numbers as floats so a later fraction is never cut off; arrow reads Arrow IPC instead. Options go after #, where the server never sees them.

  • key=COLUMN keeps the latest row of each key; without it every row is kept, numbered, the newest million
  • subscribe=TEXT sends a message each time the connection opens
  • A lost connection is opened again
  • The status bar shows each stream's connection, rows per second and messages skipped
terminal
# the latest reading of each sensor
densa-studio "wss://example.com/readings#key=sensor"
# every message, read as Arrow IPC, its table named events
densa-studio "wss://example.com/events#arrow&name=events"

Times, windows and counts

time=COLUMN makes a column of numbers or text UTC timestamps as rows arrive (one of timestamps or dates stays as it is): the grid shows times, SQL works on them and charts put them on a time axis. Beside it, window= keeps only the recent rows, and per= counts the rows of each second, minute or day as they come.

  • Numbers are read as milliseconds since 1970 unless unit= says s, us or ns; text as ISO 8601
  • window=10m keeps the rows within ten minutes of the newest, by the data's own times, not the clock
  • per=1m adds a tab of bars below the source, one a minute, following the newest; the live table keeps the counts, so drawing them never reads every row
  • Buckets run back to back from 1970 in UTC, so per=1d days start at midnight UTC
terminal
# the last ten minutes of readings, counted per minute
densa-studio "wss://example.com/readings#time=time&window=10m&per=1m"
query.sql
-- times work in SQL as they are
SELECT date_trunc('minute', time) AS minute, avg(celsius) AS celsius
FROM readings
GROUP BY 1

Joins, live

join=COLUMN:TABLE gives each row of a stream or Flight source the columns of the row of another open table whose column of the same name holds the same value: each reading its site's region and alarm temperature, as in the recording at the top. Both sides stay current.

  • Rows are joined as they arrive, and a row of the other table that arrives or changes updates every row naming it at once
  • The other table can be a file, a stream or a Flight result, opened before or after, but not the source itself or one joined itself
  • join=COLUMN:TABLE.KEY when the other table's column has another name
  • Rows naming nothing get nulls in those columns; a column name both tables have gets the other table's name in front
  • pairs=COLUMN:TABLE shows each row with every row of the other table holding the same value instead (each order with each address of its customer), once with empty columns if none does, keyed by a pair column
  • SQL, the window and the counts see the joined rows
terminal
# each reading with its site's columns
densa-studio sites.csv "wss://example.com/readings#key=sensor&join=site:sites"
query.sql
-- sensors above their own site's alarm, per region
SELECT region,
  sum(CASE WHEN celsius > alarm_celsius THEN 1 ELSE 0 END) AS above_alarm
FROM readings
GROUP BY 1

Arrow Flight, and secrets out of sight

A grpc:// or grpc+tls:// URL opens a Flight service's data in a tab that fills as it arrives: sql=QUERY asks a Flight SQL server, path=A/B asks for a dataset and ticket=T for a ticket's data. tables lists a Flight SQL server's tables with their columns, and Enter opens one.

  • A service that cannot be reached is asked again, with waits that grow; the first query does not wait for it
  • header=NAME:VALUE sends a header, to streams too; $NAME in its value is read from the environment when the source opens
  • So a token is never typed, shown or kept in the saved arrangement
  • A user and password in a URL are refused: they go in a header
terminal
# a Flight SQL server's tables, with their columns
densa-studio "grpc://localhost:50051#tables"
# a query's result, the latest row of each id
densa-studio "grpc://localhost:50051#sql=SELECT * FROM trips&key=id"
# single quotes leave $KEY for Studio to read from the environment
densa-studio 'grpc+tls://example.com#tables&header=x-api-key:$KEY'

03 — Reference

Every option, in one place.

Options go after the # of a stream's or Flight service's URL, where the server never sees them, joined with &: #key=sensor&time=time. In their values, write &, # and % as %26, %23 and %25. A span is a number and a unit: 500ms, 30s, 10m, 2h, 1d.

After # in any URLstreams and Flight

  • key=COLUMNKeeps the latest row of each key. Without it every row is kept and numbered in a row column; a stream keeps the newest million.
  • name=TABLENames its table for SQL, written as file names are (a taken name gets a number). Otherwise a stream's table is named after the last part of its path, or its host; a Flight result's after the last part of its path=, or flight; a list of tables is tables, and a table opened from it is named after that table.
  • time=COLUMNMakes a column of numbers or text UTC timestamps as rows arrive: numbers are milliseconds since 1970, text is read as ISO 8601; timestamps and dates stay as they are. Values that cannot be read become nulls, counted in the status bar, and the rows come all the same.
  • unit=sWhat a number column of times counts: s, ms, us or ns.
  • window=SPANKeeps only the rows within SPAN of the newest time in the data, not the clock. Goes with time=.
  • per=SPANCounts the rows in each SPAN of the time column, in a tab of bars below the source; a whole number of the column's unit. Goes with time=.
  • join=COLUMN:TABLEGives each row the columns of the row of TABLE whose COLUMN holds the same value; join=COLUMN:TABLE.KEY when that column has another name there.
  • pairs=COLUMN:TABLEShows each row with every row of TABLE whose COLUMN holds the same value, once with empty columns if none does, keyed by a pair column; pairs=COLUMN:TABLE.OTHER when that column has another name there. A source takes one of join= and pairs=; window= does not go with pairs= yet.
  • header=NAME:VALUESends a header, any number of times. $NAME or ${NAME} in the value is read from the environment when the source opens; $$ is a $.

On the command linedensa-studio

  • FILE or URLCSV and Parquet files, ws:// and wss:// streams, grpc:// and grpc+tls:// Flight services, opened in order.
  • --sampleOpens the sample data, made on your machine.
  • --query SQLRuns a query once the files have loaded.
  • --liveRuns the query again each second while its sources change.
  • --freshStarts from the default arrangement instead of the saved one.
  • --pagedReads every Parquet file a page at a time, whatever its size.
  • --lightUses the light theme.
  • --seconds NCloses after N seconds.

After # in a stream's URLstreams only

  • subscribe=TEXTSends TEXT each time the connection opens, any number of times.
  • arrowReads Arrow IPC messages instead of JSON.

After # in a Flight URLone of these

  • sql=QUERYThe result of QUERY, from a Flight SQL server.
  • path=A/BA dataset, by its path.
  • ticket=TThe data of a ticket.
  • tablesA Flight SQL server's tables with their columns; Enter or a double click opens one.

Kept between runsfiles

  • layout.txtThe arrangement of tabs and panels, in a densa-studio folder in your configuration folder: %APPDATA% on Windows, ~/Library/Application Support on macOS, $XDG_CONFIG_HOME or ~/.config elsewhere. Sources are found in it by their files and URLs; no header is kept in it.
  • the sampleIn a densa-studio folder in your cache folder, written the first time.

Try it

Open your data and watch it move.