Fork me on GitHub
#datomic
<
2016-12-20
>
ckarlsen00:12:40

it's literally datomic.client/PRO_ACCOUNT

kenny00:12:01

I tried that and I get Incomplete or invalid connection config:

marshall01:12:26

@kenny you need to run a peerserver against your ddb database

marshall01:12:36

Then connect clients to that peer server

marshall01:12:10

Db name is the "alias" you provide to the peer server when you start it against your ddb uri

marshall01:12:58

@kenny ^ running peer server documented there. Info on connecting a client to it is lower on the page

kenny01:12:22

Ah, that makes sense. The exact steps you need to follow to use the client API aren't clear in the docs šŸ™‚ Thanks for the info

marshall01:12:23

Sure. Let me know if you have suggestions as to how/where that could be specified better

kenny01:12:16

I think the confusion for me was actually needing to go through the "Getting Started" docs. I assumed that I didn't need to read "Getting Started" because we have been using Datomic for a while now and I know all the basics. Maybe it should be called "Getting Started with Clients"?

marshall01:12:30

Ah, yeah I think the new getting started does cover how to run and connect with peer server

marshall01:12:51

I'll see where/ how I might clarify that

xk0502:12:30

What does this mean?

xk0503:12:26

oh, n/m, i confused <system-name> with <table-name>, i guess

Drew Verlee04:12:14

Im trying to setup datomic on postgres in heroku. Im on this step: > open a SQL window on that server and paste in the bin/sql/postgres-table script From http://docs.datomic.com/storage.html Iā€™m not sure what a SQL window is referring to. Googling ā€œSQL windowā€ doesnā€™t get me close to what i imagine. I imagine somewhere there is a script to setup the tables the way datomic wants them, and i need to run that in this SQL window. But i dont know where either is.

Drew Verlee04:12:33

this postgres file is probably in my project directory somewhere...

Drew Verlee04:12:15

looks like i probably need to download datomic to get it šŸ™‚

Drew Verlee05:12:49

similar issue on this step: > If you are using a Heroku hosted PostgreSQL instance, edit your sql-transactor-template.properties as follows: Which is simply that i dont see a ā€˜sql-transactor-template.propertiesā€™ file anywhere. I see a config/samples/free-transactor-template.properties which i could copy and change the file name. But im not sure thats right, especially as the next step suggest there should be a sql-url variable in the file (which there isnā€™t). I could write it down, but that feels odd.

gdeer8105:12:08

@drewverlee the free transactor is only for in-memory, you'll have to set up a starter license if you want to use postgres for your storage layer

Drew Verlee18:12:33

Hmm ok, so iā€™m a tad stuck. I want to deploy a full stack clojure app to heroku using datomic ontop of postgres. I assume i should include my datomic-pro dep in my project file:

[com.datomic/datomic-pro "0.9.5544" :exclusions [com.google.guava/guava org.slf4j/log4j-over-slf4j org.slf4j/slf4j-nop]]
Which seems to work as lein uberjar reports success. But then as i would expect it fails when i try to deploy to heroku it fails. I assume because it cant verify my license? This walkthrough (https://github.com/jamesmartin/datomic-tutorial) seems to suggest i should add:
:repositories {"" {:url ""
                                   :creds :gpg}}
to my project.clj. But i dont see any offical docs on the subject.

Drew Verlee18:12:45

Maybe a better question would be, whats the simplest way to get something deployed šŸ™‚

marshall18:12:45

@drewverlee what specifically fails when you try to deploy? launching the transactor is what will require a valid license; Iā€™m not sure whether details have changed, but I believe there used to be some hoops to jump through to get a transactor running using heroku

marshall18:12:58

due to IP and inter-instance communication configurations

marshall18:12:56

do you have a transactor up and running? or are you attempting to deploy both a peer and a transactor?

Drew Verlee18:12:37

@marshall Thanks for the help. the failure message when i run git push heroku is:

remote:        Could not find artifact com.datomic:datomic-pro:jar:0.9.5544 in central ()
remote:        Could not find artifact com.datomic:datomic-pro:jar:0.9.5544 in clojars ()
remote:        This could be due to a typo in :dependencies or network issues.
remote:        If you are behind a proxy, try setting the 'http_proxy' environment variable.
remote:        Uberjar aborting because jar failed: Could not resolve dependencies
remote:  !     Failed to build.
> do you have a transactor up and running? Not yet. Im not sure what the order should be, this is what im currently doing: build clojure project e.g lein new luminus vending_machine_app +re-frame +datomic edit my project.clj to use datomic pro (x) deploy to heroku follow setup datomic database instructions (which involves setting up the transactor)

marshall18:12:22

gotcha. So that error does indicate your app is unable to get the datomic peer library from the private maven repo

marshall18:12:42

youā€™ll need to configure that via the directions provided in your http://my.datomic.com dashboard

Drew Verlee18:12:52

@marshall Its probably important to know that im going headfirst at this, with very little background šŸ™‚

marshall18:12:15

however, Youā€™ll also need a running transactor up for your peer to connect to before it can ā€œdoā€ anything

marshall18:12:12

in general, the ā€˜startupā€™ order for a Datomic system would be: 1) provision/configure storage (i.e. Postgres or Dynamo) 2) start your transactor instance 3) start your app, which uses the Datomic peer library

Drew Verlee18:12:43

@marshall ok, great. I see the instructions i missed on http://my.datomic.com.

marshall18:12:21

more details on storage setup can be found here: http://docs.datomic.com/storage.html

marshall18:12:43

the writeup on running Datomic in AWS (http://docs.datomic.com/aws.html) might also be helpful, although of course the AWS-specific parts wonā€™t work for Heroku

Drew Verlee18:12:00

@marshall of the two, paths (heroku vs AWS) which is the smoothest. Iā€™m doing a barebones toy application just to get this stuff live

marshall18:12:39

in general the AWS path is the fastest for getting the storage & transactor up and running

marshall18:12:49

we provide a set of scripts that automate most of it

marshall18:12:33

and youā€™ll have a transactor up and running

marshall18:12:48

after that, just deploy your application that uses the Peer library to EC2 however you like

robert-stuttaford18:12:10

@drewverlee you can also use terraform; @mrmcc3 put together a codebase for transactor + peers, you can use the transactor bit https://github.com/mrmcc3/tf_aws_datomic

matthavener18:12:21

drewverlee: FWIW, if you are going with heroku, there are a few heroku datomic buildpacks that make setting up the transactor a little easier

wei19:12:58

is there a general way to implement composite attributes on top of datomic? by that I mean attributes which are unique when taken together. my current method is using a special key where the values are concatenated, e.g. :composite/team.id|user.id but this adds a lot of extra complexity around upserting entities.

gdeer8119:12:27

@wei I think there is a feature request for that, so go to your http://my.datomic.com profile and upvote it

wei19:12:43

upvoted, thanks. was wondering what others were doing in the meantime

robert-stuttaford19:12:17

@wei youā€™re talking about what SQL calls composite primary keys, and Datomic does not support them

robert-stuttaford19:12:25

you can do your own with transactor functions

robert-stuttaford19:12:13

hereā€™s a snippet. we eventually caved in and had our tx fn make a string value out of the parts so that we had a simple ā€˜primary key'

robert-stuttaford19:12:12

if you think it through, such a feature would add quite some complexity to the system, which i donā€™t think would be worth it

robert-stuttaford19:12:45

ā€¦ but iā€™m not Rich Hickey, so itā€™s very possible iā€™m ignorant in several key ways

wei19:12:31

thanks for sharing. yes, I was reading some previous literature around using tx fns for composite keys, and it looks like every solution so far has some major limitations (e.g. not being able to add multiple entities in the same tx). was wondering if I was missing something critical as well

robert-stuttaford19:12:36

the current system is based on a few solid rules. adding this would complicate things quite a bit i think

wei19:12:39

in your schema, is :meta/tag-slug the only unique attr?

robert-stuttaford19:12:39

we have a helper function too

wei19:12:00

think Iā€™m not following completely. if you wanted to put a composite key on several entities, would you reuse this db function or create a separate function for each entity?

robert-stuttaford19:12:32

so this is a concrete implementation for one entity kind

robert-stuttaford19:12:06

a fully generic implementation would be so indirect and meta, itā€™d be useless (thatā€™s an intuition)

wei19:12:44

thatā€™s what Iā€™m thinking too. but we have many composite keys in our system and itā€™s getting tedious to re-implement this for each

robert-stuttaford19:12:38

do your comp-keys follow any sort of a pattern? e.g. 2-3 strings

wei19:12:32

not an uncommon requirement in my opinion- for example, user ids in some external system are unique only within a group (team)

wei19:12:02

yes, itā€™s usually 2 strings. but sometimes one part of the composite string is based on an attribute from a joined entity, which complicates things so Iā€™m debating whether thatā€™s necessary

robert-stuttaford20:12:57

perhaps it may be useful to think about how youā€™d model this data in a new database, from first principles, rather than as an import from a different data modelling paradigm

wei20:12:52

true. currently we have things like :composite/team.slack-id|user.slack-id (need a userā€™s slack id and a teamā€™s slack id to uniquely identify a user) and :composite/team.uuid|tag.name (need the team and tag name to uniquely identify a tag). I do think composite keys are necessary in these cases, but maybe splitting it along a different dimension would make things easier.

wei20:12:37

at any rate, thanks for the tips. if you wouldnā€™t mind posting your helper function, that would help me as well

kwladyka22:12:56

hmm i think i found some kind of bug: when i have [com.datomic/clj-client ā€œ0.8.606ā€]in dependency it spoils jetty ring. When in run lein repl and then (use ā€˜ring.adapter.jetty) i have an error CompilerException java.lang.NoClassDefFoundError: org/eclipse/jetty/http/HttpParser$ProxyHandler, compiling:(ring/adapter/jetty.clj:27:11) - it makes this bug even on this simple example https://github.com/ring-clojure/ring/wiki/Getting-Started

dominicm23:12:20

Can I do pull inside a query on a sequence based db (like the [fred :likes blah] example in the query docs)? By default I get an exception, but I might be doing it wrong