To work with databases and datoms, Datomic provides the following set of operations.
The Datomic API allows you to create, list, and delete databases. For more information, see the Client API.
Databases are accumulate-only, and all new information is added by fully
serialized ACID transactions. The
transact operation takes as its
- a connection to a database
- a collection that can include raw assertions, raw retractions, and transaction functions for conditional operations.
For example, to increase an item's price by 10%, you would pass a
transaction function to
transact, and two new datoms would be added to
- a retraction of the previous price
- an assertion of the new price
For more information, see transactions.
Schema attributes are ordinary entities in a database, and are added via ACID transactions just like any other data. Schema attributes must be defined in a transaction prior to any transaction that uses them.
For more information, see schema.
query operation provides access to Datomic Datalog, a powerful
deductive query system. Datomic Datalog includes unification, joins,
predicates, functions, conjunction, disjunction, negation, and reusable
pull operation is a declarative way to make hierarchical (or
nested) selections of information about entities.
query and also available as a standalone API.
For more information, see query.
Datomic is accumulate-only, remembering the history of all information.
db operation returns the current value of a database. This value
can then be filtered:
as-ofoperation filters a database back to a past point in time
sinceoperation filters a database to include only datoms after a point in time
historyoperations returns an unfiltered view of all present and past information.
Datomic transactions are reified, that is, transactions are themselves
entities in a database. You can use
pull to retrieve
information about transactions associated with an entity. Or you can go
in the opposite direction, retrieving datoms from transactions directly
For more information, see time.
Datomic provides direct iteration on indexes. Most applications will not
use this, and you should prefer instead the higher-level
datoms operation can seek to a point in any index and iterate from
there, and the
index-range operation can provide a value range from the
For more information, see indexes.