Graph analytics in SQL
Ursa is a SQL engine for graphs. Point the ursa command-line tool at an edge list in Parquet, CSV or JSON, name it as a graph, and run PageRank, Louvain, shortest paths and the rest as table functions. It works like DuckDB: one binary, no server.
curl -fsSL https://ursagraph.dev/install.sh | shOn Linux or macOS. On Windows, in PowerShell: irm https://ursagraph.dev/install.ps1 | iex. Or cargo install ursa-cli; see Installation.
Ursa Shell is the ursa shell in a web page: the same engine, compiled to WebAssembly, runs in your browser, with nothing to install. The button starts its five-step tour.
A file is a table. Name it as a graph, then run an algorithm.
CREATE PROPERTY GRAPH club
EDGE TABLES ('karate_edges.csv' SOURCE KEY (src) DESTINATION KEY (dst));
SELECT id, round(pagerank, 4) AS pagerank
FROM pagerank(club, direction => 'both')
ORDER BY pagerank DESC
LIMIT 5;┌───────┬──────────┐
│ id │ pagerank │
│ Int64 │ Float64 │
├───────┼──────────┤
│ 33 │ 0.1009 │
│ 0 │ 0.097 │
│ 32 │ 0.0717 │
│ 2 │ 0.0571 │
│ 1 │ 0.0529 │
└───────┴──────────┘Zachary's karate club: 78 friendships between 34 members (the Quickstart downloads karate_edges.csv). Try this query live in Ursa Shell, or go on from here with the Quickstart.
Files are tables
Query Parquet, CSV, JSON and Arrow where they are, on your disk or in S3, GCS and Azure. Nothing to load first.
A graph is an edge table
CREATE PROPERTY GRAPH, from the SQL standard, names an edge table and its endpoints. Node attributes are optional.
Algorithms are table functions
PageRank, components, Louvain, betweenness, shortest paths and more. Join them to anything on id.
Patterns in SQL/PGQ
GRAPH_TABLE matches nodes, edges and paths of any length, and runs DuckPGQ's examples as written.
Like DuckDB
One binary, no server, a familiar shell and dot-commands, and a .ursa database file that keeps your work and graph indexes. ursa serve opens the shell in a browser tab.
Results you can check
Parallel, deterministic Rust kernels, each pinned to the NetworkX function it matches.
Ursa is pre-1.0: the SQL may still change between minor versions, and the changelog records every change. The Python library, ursa-graph, is on hold; see its README.