Fork me on GitHub
#datomic
<
2015-08-13
>
misha00:08:40

=> {:db/id 17592186045443} means :my/attr is installed. => nil means it is not

sdegutis00:08:00

@misha, @bkamphaus aha! It's definitely not there, it returns nil.

sdegutis00:08:05

Well, {:db/id nil}

sdegutis00:08:23

@misha: So what reason could it be nil when I definitely installed it in a transact?

misha00:08:39

@sdegutis how did you install it exactly?

sdegutis00:08:47

@misha: (d/transact conn txs) where txs included {:db/id (d/tempid :db.part/db), :db/ident :question-template/sort-pos, :db/valueType :db.type/long, :db/cardinality :db.cardinality/one, :db.install/_attribute :db.part/db}

sdegutis00:08:58

But (d/entity db :question-template/sort-pos) returns {:db/id nil}

bkamphaus00:08:26

there are a variety of reasons this could be the case — that transaction didn’t succeed, that transaction went to a different conn, the conn had the db deleted/recreated prior to following transaction, the order of transaction differs from your expectations, etc.

sdegutis00:08:12

Is there a way to determine the reason?

bkamphaus00:08:30

As a sanity measure, one thing you could do would be to check the basis-t of the :db-after returned by the map you get from deref-ing the schema transaction vs. the basis-t of the db retrieved from the conn prior to submitting the transaction that fails.

bkamphaus00:08:31

are the transactions on the same peer process, in a way where (for at least debugging) you could guarantee the order? I.e. submit schema transaction, deref future it returns (which will block until transaction succeeds), then follow up? If you can guarantee the order, you could look at the :tx-data returned by the schema transaction.

sdegutis00:08:00

I'm using Datomic Free with the default H2 thing it uses, and using only one peer process.

sdegutis00:08:24

I always deref the future it returns immediately after getting it back.

sdegutis00:08:38

Oh wait, in this specific transact I might not be!

misha00:08:19

@bkamphaus transact's future will "complete" even if I will not deref it, right? right. what is the "correct" way to transact stuff (in the code, not in repl)? "transact, deref, and see that transaction succeeded/log any errors"?

lowl4tency00:08:54

Hi, guys as far as I remember datomic has a WebUI, it hasn’t?

misha00:08:55

sort of, yes

sdegutis00:08:16

@bkamphaus: I think you may have solved it!

sdegutis00:08:03

@bkamphaus: I've been ignoring the (transact) call's result all this time. Well just now, I finally chose to print it out (without deref'ing it, mind you) and instead of printing it out, it just died, saying: "Exception in thread "main" java.util.concurrent.ExecutionException: java.lang.Error: :transact/bad-data Changing :db/valueType to 22 is not supported for entity 315"

lowl4tency00:08:05

misha: what I should do for getting it? I’m using official ec2 AMI for transactor

lowl4tency00:08:25

ah, it’s running separetely

misha00:08:51

$ cat README-CONSOLE.md 
...
If you downloaded Console as a separate download (i.e.: not bundled with Datomic Pro), you will need to install it alongside Datomic:
Run this command from the directory you unzipped Console to:
    bin/install-console path-to-datomic-directory
Switch to your Datomic directory and run:
    bin/console -p 8080 alias transactor-uri-no-db
...

lowl4tency00:08:02

Okay, I don’t need it in this way simple_smile

lowl4tency00:08:15

CLoudWatch metrics is enough

misha00:08:34

as a separate download (i.e.: not bundled with Datomic Pro)

sdegutis01:08:34

@bkamphaus: Yep, I was changing the type of an existing attribute, which isn't allowed in our older version of Datomic. By not deref'ing the schema transact, we were never hearing about that error.

sdegutis01:08:39

@bkamphaus: Thanks, I owe you a beer.

bostonaholic04:08:48

does it make sense to :db/index true a :db.type/ref?

robert-stuttaford04:08:45

@bostonaholic: no. refs are all in VAET index already

bostonaholic04:08:08

that's what I thought, thanks @robert-stuttaford

robert-stuttaford04:08:54

so you can (->> (d/datoms db :vaet your-ref-id :some/attr) seq (map :e)) to get all relations

robert-stuttaford04:08:45

@sdegutis: probably already something you’ll do from now on, but you should always look at the results of your transact calls simple_smile

potetm17:08:06

Is there a limit on the number of attributes that d/pull will pull at one time? I’m in a situation where I’m trying to pull 14 attributes, of those 9 exist on this particular entity, but it appears to only return 8 attributes.

bkamphaus17:08:13

@potetm which version of Datomic are you seeing this behavior you’re on? There was a bug w/pull fixed in 0.9.5198 that if I remember correctly had a similar manifestation (showed up w/more than 8 attr): * Fixed bug where the pull API did not always return all explicit reverse references.

potetm17:08:04

That’ll do it simple_smile I’m running 0.9.5153

potetm17:08:27

The thing that was being dropped was a reverse reference.