This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-08-12
Channels
- # admin-announcements (3)
- # announcements (1)
- # beginners (9)
- # boot (85)
- # bristol-clojurians (4)
- # cider (12)
- # cljs-dev (3)
- # clojure (91)
- # clojure-berlin (7)
- # clojure-dev (16)
- # clojure-italy (21)
- # clojure-russia (67)
- # clojure-spain (3)
- # clojure-uk (6)
- # clojurescript (139)
- # core-async (41)
- # cursive (7)
- # datomic (61)
- # editors (56)
- # events (16)
- # hoplon (11)
- # jobs (4)
- # ldnclj (14)
- # liberator (7)
- # off-topic (13)
- # om (5)
- # re-frame (22)
- # ring-swagger (27)
@misha I’m not sure I follow your example, but if you mean unique within the collection w/the collection being that implied by the set of card-many vals (refs to enums or otherwise), then it sounds like you just want the default behavior.
(d/pull (d/db conn) '[*] 17592186045418)
;{:db/id 17592186045418
; :person/aliases ["Bert" "Bobby" "Curly" "Robert" "Robin”]}
@(d/transact conn [[:db/add 17592186045418 :person/aliases "Robert"]])
;{:db-after datomic.db.Db@b1bf43ff
; :db-before datomic.db.Db@834c4088
; :tempids {}
; :tx-data [#datom[13194139534315 50 #inst "2015-08-12T00:58:36.834-00:00” 13194139534315 true]]}
;; ^ no new data in card-many attr, only tx
(d/pull (d/db conn) '[*] 17592186045418)
{:db/id 17592186045418
:person/aliases ["Bert" "Bobby" "Curly" "Robert" "Robin"]}
Hey guys, how do I connect to heroku postgresql database? I have installed:
[com.datomic/datomic-pro "0.9.5206" :exclusions [joda-time]]
[postgresql "9.3-1102.jdbc41"]
When I try to connect as:
(def uri "datomic:)
(def conn (d/connect uri))
I get error
java.sql.SQLException: No suitable driver
clojure.lang.Compiler$CompilerException: java.sql.SQLException: No suitable driver, compiling:(server.clj:28:11)
@bkamphaus, not if you mean unique within the collection
,
with the available enum values a b c
I need to be able to have entities representing these combinations:
[a]
[b]
[c]
[a b]
[a c]
[b c]
[a b c]
And it would be nice, if adding another [a b]
would just upsert
already existing one.
Also, I am not entirely sure if this is significant or not, but you use strings as list items, and I use keywords, which are idents.
With :db/unique :db.unique/value
in :person/aliases
definition, you would not be able to have these 2 :
{:db/id 1
:person/aliases [:names/Bert :names/Bobby]}
{:db/id 2
:person/aliases [:names/Bert :names/Curly]}
And with with :db/unique :db.unique/identity
in :person/aliases
definition, the second would have overwritten the 1st one.Now – a
is treated as unique value, not [a]
. a
and b
, not [a b]
.
Re-using your example: :db.unique/value
and :db.unique/identity
enforce only one person being able to have Bert
as an alias across entire db.
Any ideas why I get multiple historic entries for an attribute that has :noHistory
set to true
? Here's a very short repl-session demonstrating it: https://gist.github.com/magnars/093c6c437b1760ac22cf
Turns out Stuart Halloway has addressed this quirk here: http://datomic.narkive.com/gIuZhcp8/db-nohistory >:db/noHistory is not a logical property of your data, it is only a storage optimization hint. The memory database has no storage, so :db/noHistory is irrelevant.
I wish it wasn't so, tho - because this makes for a real difference between my development and testing environments, and production.
anyone using dynamodb as a datomic backend, here?
curious what it’ll cost to restore 30gb of datomic backups to ddb
@robert-stuttaford: gonna bet you could e.g. dig in the backup format and count the number of segments, then assume it's something like that many writes?
such strange pricing
pay per hour for the ability to write
Hello. I am inexplicably receiving an error that I wasn't receiving this morning, during a transact.
I've reset my database to no avail, the error still occurs: clojure.lang.ExceptionInfo: :db/invalid-data Unable to resolve entity: :question-template/sort-pos {:db/error :db/invalid-data}
Wait, is that exception happening when starting transactor or when doing a specific transaction? What are the details of the transaction?
While I'm doing a transaction. One of the tx-data (a list) contains a map like this: {:question-template/sort-pos 0, ...} and includes a legitimate temporary eid as :db/id
what is schema for :question-template/sort-pos ?
{: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}
is there a way to see entire transaction? (can you anonymize or what not?)
I don't think it's related to this specific attribute. When I remove this attribute from the map, I get the same error with another attribute, and so on.
has the schema been transacted?
aww, there was someone else having a similar issue but I think it is lost to slack black hole
bostonaholic: Yes. At the beginning of starting the process, every schema is transacted again.
Here's the whole tx-data: https://gist.github.com/sdegutis/298b6f1db2672189cc4a
usually tempids look like #db/id[:db.part/user -1000106]
not sure why yours are different
kbaribeau: Yeah I noticed that too, seemed odd. Assumed it was because that's the map it really boils down to.
It succeeds as long as I omit the fields :answer-template/correct?, :answer-template/sort-pos, :question-template/sort-pos, :question-template/enabled?, :question-template/allowed-types, :question-template/answers, and :question-template/science?.
(d/create-database "datomic:")
@(d/transact (d/connect "datomic:")
[{:db/id (d/tempid :db.part/user)
:thisthing/doestnexist 0}])
^ I get a very similar error by running that. it really looks to me like your schema has not been transacted
the error I get due to missing schema is CompilerException java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: :db.error/not-an-entity Unable to resolve entity: :thisthing/doestnexist, compiling:(:62:1)
^ simplest explanation, probably best next step is to confirm those exist (and that data type matches, etc.) - the tempid map is just what d/tempid
resolves to.
i.e.
(d/tempid :db.part/user)
; <#C03RZMDSH>.db.DbId{:idx -1000000 :part :db.part/user}
If it succeeds when you omit fields, my next step would be to confirm that a problem attr’s schema has been transacted and is in the db prior to transacting (in the isolated case of free storage).
gentlemen, what is (or is there) an idiomatic way to keep track of order of items in collections in datomic?
E.g. I have 3 "reusable" item-entities: a b c
, and I want to have some list-entities which not only contain list of items, but know their order in the list as well.
The only solution I have in mind, is to wrap items in an item-container-entities, and make lists out of those:
[{:item a, :idx 0} {:item c, :idx 1}]
and
[{:item c, :idx 0} {:item a, :idx 1}]
or
[{:item a, :idx 0} {:item c, :idx 1}]
and
[{:item a, :idx 1} {:item c, :idx 0}]
@bkamphaus: How do you confirm the existence of such a thing in code?
query for the attr entity (e.g. By ident) using the db value from the conn prior to submitting the tx. Entity or attribute apis are options, too.