Fork me on GitHub
#datomic
<
2016-09-30
>
pesterhazy08:09:22

Any experiences with allowing non-programmers to query analytics data? Our main db is datomic but we can't expect our marketing/business people to learn datalog. They need simple queries but giving them the ability to write/tweak those themselves (as they could with an SQL db) would be useful.

jethroksy11:09:20

@pesterhazy you'll probably get closest to this with https://github.com/zcaudate/adi

pesterhazy12:09:38

@jethroksy that seems to try to do many things (we already have a schema etc.)

jethroksy12:09:07

right, it wasn't designed for your use case

jethroksy12:09:40

adi feels to me like a graphql-like wrapper for datomic

jethroksy12:09:11

knowledge of datalog here is not necessary, so you probably could architect something along the lines of adi

pesterhazy12:09:55

I was thinking more along the lines of - excel export based on pre-defined queries - hooking up queries to an SQL db (sqlite? mysql?)

jethroksy12:09:48

haven't seen anything like that

Ben Kamphaus14:09:52

@pesterhazy because the default return for a query is a set of tuples, it’s fairly trivial to write a function to wrap query results that exports to a comma/tab/arbitrarily delimited text file, then import it into whatever db or system you like. I did this myself several times to get stuff into a SQL store or other tabular data analysis tool (I use pandas in Python, others use R, Tableau, etc.). Of course there are also two common feature requests that would make this more trivial: (1) some kind of SQL mechanism to query Datomic (SQL->Datalog or otherwise) or (2) ability to download tuples from a query in console as CSV.

Ben Kamphaus14:09:26

The team was aware of these when I was there, but there’s also a high bar of quality that has to be cleared especially re: supporting SQL queries (because a lot of people want the ability to plug in their analysis tool of choice, which means support for all kinds of arbitrary crazy generated SQL queries no sane human would ever write).

pesterhazy14:09:53

@bkamphaus I empathize and understand a generic SQL query layer would be hard to get right

pesterhazy14:09:02

feature request (2) you mentioned would get us pretty far as well

pesterhazy14:09:58

I suppose I could easily build something like that myself

pesterhazy14:09:47

the limitation is that it would have to be a long-running process as just booting up and connecting to datomic and loading segments brings query times up to 3min (long feedback loop compared to a quick "SELECT * from orders")

Ben Kamphaus14:09:42

I don’t follow all the logic there. The Datomic system isn’t otherwise up?

pesterhazy14:09:19

the transactor is running

Ben Kamphaus14:09:39

oh booting up a new peer to do this?

pesterhazy14:09:49

as in a Jenkins job

pesterhazy14:09:42

that's what we've been doing (and what I would do in a typical SQL setting); it works fine but it's just not a great experience for interactive use because of the startup time

Ben Kamphaus14:09:00

what’s the time sensitivity of these queries? could you just periodically store/cache the query results elsewhere?

pesterhazy14:09:17

yes, we also do that (push a CSV to S3)

pesterhazy14:09:38

all of that works to some extent, I'm just thinking out loud if there's an elegant possibility I've missed

annataberski15:09:27

I’m trying to retract an entity. But when I run @(datomic.api/transact conn [[:db.fn/retractEntity [:db/ident :item/ident-name]]]), I get an error saying IllegalArgumentExceptionInfo :db.error/invalid-attribute Schema change must be followed by :db.install/attribute or :db.alter/attribute. Any thoughts on why this is happening?

Ben Kamphaus16:09:23

@annataberski it looks like what you’re trying to retract is an attribute. You can rename things and alter some aspects of an attribute ( http://docs.datomic.com/schema.html#Schema-Alteration ) - but can’t remove it outright.

bmays21:09:21

Been puzzling over a weird bug for some time now, curious to understand more about how Datomic history databases work and whether this is actually expected. What we’re seeing is multiple [e a v t] facts share the same e a t but have different v values. How would this be possible?

marshall22:09:21

When you assert a new fact (i.e. Marshall now loves ice cream) against a cardinality one attribute, that will expand into 2 datoms in that transaction. One is the retraction of the current value and the other is assertion of the new value. Both will have the same E, A, and T, but different V and Op (or added) values

bmays22:09:55

god bless 🙏

marshall22:09:31

Bind [e a v t op] and you'll see the difference

bmays22:09:14

Makes sense now, didn’t know retractions are automatically added

marshall22:09:54

They will for cardinality one attributes