Skip to content

Instantly share code, notes, and snippets.

@stuarthalloway
Created April 6, 2012 18:15
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save stuarthalloway/2321773 to your computer and use it in GitHub Desktop.
Save stuarthalloway/2321773 to your computer and use it in GitHub Desktop.
Datomic schema query, constrained by attribute namespace
;; Datomic sample code
;; schema query for attribute types in specified namespaces
(q '[:find ?attr
:in $ [?include-ns ...] ;; bind ?include-ns once for each item in collection
:where
[?e :db/valueType] ;; all schema types (must have a valueType)
[?e :db/ident ?attr] ;; schema type name
[(datomic.Util/namespace ?attr) ?ns] ;; namespace of name
[(= ?ns ?include-ns)]] ;; must match one of the ?include-ns
(db conn)
["db.install" "fressian"]) ;; collection for ?include-ns
@theronic
Copy link

This hangs when run against Datomic Cloud with Client API v0.8.53 because database functions are not supported on Cloud (only on-prem), but I expect to see an anomaly returned by the API. In CloudWatch you'll see a ClientSPIFault, java.lang.ClassNotFoundException: datomic.Util.namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment