Skip to content

Commit

Permalink
Docs add reference attributes (#514)
Browse files Browse the repository at this point in the history
* Add section about reference attributes
  • Loading branch information
jsmassa authored Apr 20, 2022
1 parent 7268eaa commit afcf15a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion doc/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ That means passing a config as argument overwrites java system properties and us
:id "default"} ;string
:name (generated) ;string
:schema-flexibility :write ;keyword
:keep-history? true} ;boolean
:keep-history? true
:attribute-refs? false} ;boolean
```

If you are using a backend different from the builtins `:mem` or `:file`, please have a look at the README in the corresponding Github repository. The configuration is outsourced to the backends so you will find the configuration documentation there. An example for `:mem`, `:file`, and `:jdbc`-backend you can see below. Please refer to the documentation of the [environ library](https://github.com/weavejester/environ) on how to use it. If you want to pass the config as environment variables or Java system properties you need to name them like following:
Expand All @@ -29,6 +30,7 @@ datahike.store.backend | DATAHIKE_STORE_BACKEND
datahike.store.username | DATAHIKE_STORE_USERNAME
datahike.schema.flexibility | DATAHIKE_SCHEMA_FLEXIBILITY
datahike.keep.history | DATAHIKE_KEEP_HISTORY
datahike.attribute.refs | DATAHIKE_ATTRIBUTE_REFS
datahike.name | DATAHIKE_NAME
etc.

Expand Down Expand Up @@ -141,6 +143,16 @@ Be aware: when deactivating the temporal index you may not use any temporal data

Refer to the [time variance documentation](./time_variance.md) for more information.

## Attribute References

Originally being a fork of the [DataScript](https://github.com/tonsky/datascript) project, attributes in Datahike used to be stored always as simple keywords. This would cause trouble for users switching from [Datomic](https://www.datomic.com/) as some queries were incompatible with _Datahike_ due to the difference between the attribute storing systems. In _Datomic_, attributes are not stored directly as keywords, but attributes themselves are entities that can be refered to by their entity ID. While this makes some translations between attributes and their IDs necessary, the big advantage of this approach is the increased speed due to fast integer comparisons as opposed to slower keyword comparisons necessary if the attributes are stored directly.

You can enable this feature now as follows:

```clojure
(require '[datahike.api :as d])
(d/create-database {:attribute-refs? true})
```

## Deprecation Notice
Starting from version `0.3.0` it is encouraged to use the new hashmap configuration since it is more flexible than the previously used URI scheme. Datahike still supports the old configuration so you don't need to migrate yourself. The differences for the configuration are as following:
Expand Down

0 comments on commit afcf15a

Please sign in to comment.