Datomic-compatible Datalog query engine as a DuckDB extension
Installing and Loading
INSTALL mentat FROM community;
LOAD mentat;
Example
LOAD mentat;
-- transact a schema + data into an embedded mentat store, then query it:
SELECT edn_t('/tmp/demo.mentat',
'[{:db/ident :person/name :db/valueType :db.type/string :db/cardinality :db.cardinality/one}]');
SELECT edn_t('/tmp/demo.mentat', '[{:person/name "Alice"} {:person/name "Bob"}]');
SELECT * FROM edn_q('/tmp/demo.mentat',
'[:find ?e ?name :where [?e :person/name ?name]]', '{}');
SELECT * FROM edn_q('/tmp/demo.mentat',
'[:find ?e . :in ?name :where [?e :person/name ?name]]', '{"inputs": ["Alice"]}');
About mentat
mentat is a Datomic-compatible database: an EDN/Datalog front-end over an
entity-attribute-value store with history. This extension embeds the mentat
SQLite store and exposes it to DuckDB as edn_t (transact), edn_q
(Datalog query table function, with :in inputs and asOf/since), edn_pull
(pull pattern -> JSON) and edn_eval (sandboxed mino script), so Datalog
query results can be joined against native DuckDB tables. The same engine is also
available as an embedded Rust library, a CLI, and a PostgreSQL extension
(pg_mentat). Source: https://codeberg.org/gregburd/mentat
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| edn_eval | scalar | NULL | NULL | |
| edn_pull | scalar | NULL | NULL | |
| edn_q | table | NULL | NULL | |
| edn_t | scalar | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
This extension does not add any settings.