Fork me on GitHub
#datomic
<
2018-12-01
>
abdullahibra18:12:30

Hi guys, I'm in situation which need to build database tables on demand, for example how to model the data storage when user1 wants to create table to save student name and age and user2 wants to save table for x and y and z, x data type string, y is time stamp, z is integer

abdullahibra18:12:37

What I want to do is to let the user create his own tables on demand , how can I model this in datomic?

potetm18:12:54

I mean, you can let them transact db attrs.

potetm18:12:58

If you’re into that kind of thing.

mdhaney18:12:36

@abdullahibra Yes, it’s very easy in Datomic. The only scheme you define is for attributes, and tables (or entities, as Datomic calls them) can have any mix of attributes you want.

potetm18:12:56

You don’t really want 1million attrs though.

potetm19:12:04

So it’s a little more complicated than that.

potetm19:12:14

(the same as you don’t want 1million db tables)

abdullahibra19:12:01

Well, so I need to make the schema first?

potetm19:12:44

So, is there a fixed number of “columns” you’re interested in?

potetm19:12:20

student name, age, time, grade, addr, etc. But there’s like 20 of them instead of “whatever your client can imagine.”

abdullahibra19:12:32

Nope, this should certainly up to the user

potetm19:12:56

Seems like you might want some entities like: {:db/id 1, :column/name "foo"} {:db/id 2 :row/column 1 :row/value "bar"}

potetm19:12:05

so a “column” entity and rows can refer to it

mdhaney19:12:34

So you want the user to define attributes as well? In that case, you almost certainly need some metadata so your code will know how to deal with those attributes, so I would add a meta layer where user attributes are defined as entities.

Chris19:12:53

What @potetm said seems right to me, plus record the type the user asked the column to be so you can do any conversions necessary

4
abdullahibra19:12:28

That's good thanks guys

abdullahibra19:12:11

Another thing could apache Jena be close alternative to datomic ?

abdullahibra19:12:43

Is datomic considered rdf facts store + other?

abdullahibra19:12:16

Other is defined as some features

potetm19:12:19

can of worms that^

potetm19:12:17

I honestly don’t know enough about rdf to answer the question. It’s an [entity attribute value] store (which seems similar to rdf to my unexperienced eye)

mdhaney19:12:25

@abdullahibra There was a talk at the Conj years ago that you should check out. It’s not exactly what you’re trying to do, but should give you ideas for how to dynamically build this meta layer for your user attributes. https://youtu.be/sQCoTu5v1Mo

potetm19:12:39

but it’s immutable, so all previous versions are available

potetm19:12:08

so it’s like an index + log + [e a v] store

abdullahibra19:12:36

@mdhaney thanks for the link

👍 4
abdullahibra19:12:40

@potetm so seems triple store + other is correct

potetm19:12:52

seems like it

potetm19:12:18

highly read scalable, write constrained are the other important bits I can think of

lwhorton21:12:36

are the client librarys open source? i can’t seem to find them anywhere. the reason i ask is i’m trying to see what effort would be involved in an elixir version. unfortunately my company is neck deep in elixir and there’s a strong impedance mismatch between clojure and elixir, so i’m trying to work around it

potetm21:12:58

none of datomic is open source

marshall21:12:45

Client lib source is in a src jar in maven centeal

lwhorton21:12:54

so … not open source?

lwhorton21:12:03

it’s all probably AOT’d classes right?

potetm21:12:01

@marshall only available on the JVM tho, right?

potetm21:12:13

oh wait, nm

lwhorton21:12:55

hmm bumah dude. we have a client with a more or less a perfect usecase for datomic cloud but i can’t convince the rest of the team to walk into the promised land.

lwhorton22:12:08

and building an elixir client against the http implementation (which i’m pretty sure is deprecated now?) seems like a bad idea