Fork me on GitHub
#datomic
<
2016-07-17
>
tengstrand08:07:06

Hi. I’m new to Datomic. I have some problems with the Seattle example: https://github.com/espeed/dskel/blob/master/samples/seattle/getting-started.clj. The first thing that I don’t understand is why i can execute "(d/create-database uri)” and it returns true (success) and then stop the REPL, restart my computer and then try again and it returns false (like if the database still exists), so I have to execute "(d/delete-database uri)” first. It is an in memory database in the example "(def uri "datomic:<mem://seattle>”)”. I think this is the root of my problem, because what happens next is that I get ”duplicate key” errors when I try to load the data (submit the transaction), like if the data is already there, when I run the whole example again. Any ideas?

paulspencerwilliams15:07:13

Hey all. Has anyone been using Spec-tacular much?

calvis15:07:34

@paulspencerwilliams: well, I have! but I don’t think many other people do haha

paulspencerwilliams17:07:02

@calvis: it looks like a neat DSL.

paulspencerwilliams17:07:48

@calvis: can / would use use the specs as ‘records’ throughout the rest of an application, or keep these contained within a ‘db layer’, and use records or maps across the app?

calvis17:07:47

@paulspencerwilliams: yes we use them throughout, I think the only time we don’t is when we have a required field on the database that isn’t necessarily required off the database. I’d like to add a more precise specification for that type of field

paulspencerwilliams17:07:36

@calvis: and you just use the

(house
functions to create them as needed in controller for example?

paulspencerwilliams17:07:03

Cool. Cheers. Will play. It seemed a little boilerplaty to have both defrecords and defspecs around.

jaret19:07:10

@teng: I tried to re-create the issue you are facing and was unsuccessful. Tell me if I have your steps in correct order: 1. Def the URI 2. d/create the uri 3. C-d (control D or quit the REPL) 4. Restart machine

jaret19:07:47

@teng when I even c-d the Repl I am able to create a new in-memory DB with the same name with no problem.

jaret19:07:59

@teng I also skipped ahead and tried d/deleting the in-memory DB and was able to remove and re-create it and load the schema again

jaret19:07:02

@teng are you sure you are passing in the :mem protocol and not :dev or :free?