Fork me on GitHub
#datomic
<
2017-05-23
>
devn03:05:13

@ghadi what's Prometheus?

devn03:05:21

I am not familiar

ghadi04:05:48

A superb monitoring system

val_waeselynck12:05:46

@hendriklouw your query has O(n^2) complexity

val_waeselynck12:05:05

you're scanning every (person, person) pair

val_waeselynck12:05:10

try this instead

val_waeselynck12:05:38

this one has O(n) complexity

hendriklouw12:05:40

nice, that works perfectly. Thank you @val_waeselynck

erichmond15:05:22

I have Datomic Pro, how does the 2 days support work?

erichmond15:05:28

who/what do I contact

Lone Ranger17:05:51

could anyone possibly explain a use case for db.type/ref?

devth17:05:23

an attribute whose value references another entity

devth17:05:53

might make sense in the context of a cardinality many attribute, e.g. a person might have multiple addresses

Lone Ranger17:05:57

okay... so the "value" of such a datom would be another entity?

devth17:05:14

the value is a reference to another entity

devth17:05:30

when you transact a value you can use the other entity ID directly, or a lookup ref (see http://blog.datomic.com/2014/02/datomic-lookup-refs.html)

Lone Ranger17:05:47

like if I had a user and I had a project and I wanted to make a schema for the project owner, that would probably be a :db.type/ref with the user as the owner?

Lone Ranger17:05:02

gotcha, thank you!

Lone Ranger17:05:31

okay let's say I have a bunch of schema {:db/ident user/attr ...} ... is it is possible to query all attributes that are available for user/*?

devth17:05:29

if you're getting all user/* attributes for a single entity use a pull query

devth17:05:03

or if for multiple entities you can use pull-many

Lone Ranger17:05:32

maybe I should be more clear I'm not looking for the attributes for any specific entity just all the attribute fields that relate to user

Lone Ranger17:05:14

I mean I can clearly see them in the console but I'm wondering if there's a programmatic way to get them

devth17:05:17

an attribute can belong to any entity - it's not like a traditional relational table

devth17:05:02

you could probably do something with database functions in a datalog query, e.g. starts-with?

Lone Ranger17:05:04

okay let me rephrase... is there a way to query over all the attributes and just get the ones that have :user as the beginning of their keyword?

devth17:05:48

not something you'd typically need to do

Lone Ranger17:05:10

agreed -- just feeling my way around

favila17:05:27

[:find [?attr-ident ...]
 :where
 [:db.part/db :db.install/attribute ?attr]
 [?attr :db/ident ?attr-ident]
 [(namespace ?attr-ident) ?attr-ns]
 [(= ?attr-ns "user")]]

favila17:05:04

@goomba note the namespace function

Lone Ranger17:05:41

interesting... is the ... significant?

favila17:05:23

destructures so you get a list of items instead of a list of relations

Lone Ranger17:05:49

okay, awesome 😄

Lone Ranger17:05:13

now when I run this I'm getting Don't know how to create ISeq from: clojure.lang.Keyword ... could that just be because I haven't populated any data yet?

Lone Ranger17:05:11

I'm looking up the docs I'm just trying to figure out which part of that query is supposed to be literal and which I'm supposed to fill in values for... e.g. in the :db.part/db am I supposed to put in the name of the db or is that a literal?

Lone Ranger17:05:42

also @favila what are you up to like 5 beers that I owe you now? 😂

favila17:05:04

the query is all literal

erichmond18:05:10

has anyone seen this kind of error when trying to restore-db? java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.amazonaws.AmazonClientException: Unable to execute HTTP request: <bucket>.