Introduction
Ursa SQL is a SQL engine for graph analytics, used through a command-line tool called ursa. It works like DuckDB. You point it at Parquet, CSV, JSON or Arrow files, on your disk or in object storage, and query them with SQL. Graph algorithms are part of that SQL. Nothing needs converting or loading first.
CREATE VIEW ties AS SELECT * FROM 'karate_edges.csv';CREATE PROPERTY GRAPH club EDGE TABLES (ties SOURCE KEY (src) DESTINATION KEY (dst));
SELECT * FROM pagerank(club, direction => 'both')ORDER BY pagerank DESCLIMIT 3;┌───────┬─────────────────────┐│ id │ pagerank ││ Int64 │ Float64 │├───────┼─────────────────────┤│ 33 │ 0.10091893648817557 ││ 0 │ 0.09699751091990577 ││ 32 │ 0.07169303486619161 │└───────┴─────────────────────┘Try it live in Ursa Shell, which runs the same engine in your browser: the link shows the three statements and runs them when you answer y. Or take the tour, five steps on the karate club from PageRank to a drawing of the graph. To install ursa, see Installation.
What it is
Section titled “What it is”- Files are tables.
SELECT * FROM 'edges.parquet'reads the file: Parquet, CSV, JSON/NDJSON (.json,.jsonl,.ndjson) and Arrow. Globs, directories and compressed CSV and JSON work too. So dos3://,gs://,az://andhttps://URLs, and DuckDB’sread_parquet,read_csvandread_json. - A graph is an edge table.
CREATE PROPERTY GRAPH, from the SQL standard (SQL/PGQ), names the edge table and its two endpoint columns. A node table with attributes is optional. - Algorithms are table functions.
pagerank(club)returns one row per node. Join it to anything onid. Parameters are named:damping => 0.9. - A database file keeps your work.
ursa club.ursakeeps your views, graphs and the graph indexes Ursa builds, so the next query does not rebuild them.
The engine is built on Apache DataFusion, so the rest of SQL works as DataFusion runs it: joins, aggregates, window functions, COPY … TO.
The Python library
Section titled “The Python library”Ursa began as a Python library, ursa-graph on PyPI, with a Polars-shaped DataFrame API over the same Rust core. It is on hold: Ursa is developed as a SQL engine now, and the library may not be maintained. Its algorithms are the same kernels and give the same values. See its README.
Where to go next
Section titled “Where to go next”- Quickstart: define a graph and run algorithms on it.
- The database file: what a
.ursafile keeps, and how stored indexes work. - The shell: dot-commands, init files and history.
- Statements: reading and writing files,
CREATE PROPERTY GRAPH,SHOW GRAPHS,DESCRIBE GRAPH,ATTACHand the settings, and the pages that cover each. - Differences from DuckDB: what carries over from DuckDB, and what does not.
- Coming from SQL/PGQ or DuckPGQ: what runs unchanged, what differs, and Ursa’s extensions.
- Function reference: every graph function, its parameters and its output.
- Result metadata: how a result says what its columns are (a node, a metric, a path), for programs that read one.
- The agent skill: teach a coding agent to write Ursa SQL.