Skip to main content

Crate ursa_sql

Crate ursa_sql 

Source
Expand description

Ursa SQL: DataFusion’s dialect plus Ursa’s own statements.

parse_sql splits a string into UrsaStatements. execute runs one on an engine session (see ursa_engine::new_session). Statements DataFusion knows are planned and run by DataFusion, except that one may not drop a table a graph uses, or replace it by one the graph no longer fits (ursa_engine::graph::check_ddl). CREATE PROPERTY GRAPH and DROP PROPERTY GRAPH define graphs (see property_graph for the subset of SQL/PGQ supported); SHOW GRAPHS and DESCRIBE GRAPH describe them. SHOW ursa.<setting> shows one of Ursa’s settings, and SHOW ALL lists them with DataFusion’s (see settings). SHOW TABLES lists the tables and views, without information_schema’s own views. read_parquet(...), read_csv(...) and read_json(...) open their files before a statement is planned (see ursa_engine::read_functions).

A session may have a .ursa database (database): open_session opens one, and ATTACH 'club.ursa' opens one in an in-memory session that has defined nothing yet. In such a session, statements that define or drop views, external tables and graphs are kept in the database’s catalog file. Relative file paths resolve against the current directory when a statement runs, as in DuckDB; a stored definition’s paths are rewritten relative to the directory holding the file (see database).

Re-exports§

pub use database::open_session;

Modules§

database
Statements in a session with a .ursa database.
graph_table
SQL/PGQ’s GRAPH_TABLE ( … ), rewritten before sqlparser sees it (#296).
property_graph
The table clauses of CREATE PROPERTY GRAPH: SQL/PGQ’s element tables (#295).

Structs§

Attach
CreatePropertyGraph
CREATE PROPERTY GRAPH: Ursa’s subset of SQL/PGQ (see crate::property_graph).
DescribeGraph
DropPropertyGraph
OpenOptions
How to open a database.
UrsaParser
Ursa’s parser: DataFusion’s, with Ursa’s statements recognised first.

Enums§

UrsaStatement
One statement of Ursa SQL.

Constants§

DEFAULT_RECURSION_LIMIT
Same as sqlparser’s and DataFusion’s default.

Functions§

execute
Run one statement on ctx. The returned frame is lazy for a query, and already applied for DDL (as with SessionContext::sql).
execute_with_text
execute, with the statement’s text as written (from parse_sql_with_text_for), which a database stores when the statement’s Display does not round-trip.
parse_sql
Parse sql (one or more statements separated by ;) with the generic dialect.
parse_sql_for
Parse sql with the session’s configured dialect and recursion limit.
parse_sql_with_text_for
parse_sql_for, with each statement’s text as written (see execute_with_text).