Fork me on GitHub
#datomic
<
2018-08-10
>
eoliphant00:08:33

So @ghadi, another approach would be just wrapping your ‘real’ ion code with a higher order function ‘authorizer’. That might give you what you need.. But just out of curiosity, how are you identifying the ‘principal’ to whom the temp token is issued? we have a pretty complex AWS setup, and avoid IAM users, etc. We issue tokens for say AWS API access, via integration with Keycloak and LDAP. You mentioned bless which is similar, in that you need to have a ‘session’ in order to get the cert issued.

spieden04:08:43

i wanted to copy some entities between dbs, and came up with the hack of pulling them with [*] and applying this:

(defn tempify-entity [entity partition]
  (walk/prewalk (fn [node]
                  (if (and (instance? MapEntry node)
                           (= :db/id (key node)))
                    (MapEntry. :db/id (d/tempid partition (- 0 (val node))))
                    node))
                entity))
this worked and resolved all references, but the tempid docs say only to use ns from -1 to -1000000. can i cause some type of tempid collision in datomic land by doing this?

matthavener20:08:14

Datomic supports strings as tempids now, so you could just do (str (:db/id thing)) instead

ghadi14:08:56

@eoliphant I thought about this a bunch last night, I think the "right thing" to do is generate an STS session token before the invoke of a lambda, and pass the temp credentials+token through to the Ion, then AssumeRole inside the code

8
eoliphant14:08:16

That sounds like a plan

ghadi15:08:40

the only downside is that session tokens are minimum 15 minutes in length

eoliphant00:08:52

yeah, they are more geared to stuff like handing a user one for API access or something

tlima14:08:52

Sorry if this is a silly question, but how should I pack my own Java static method with the Transactor, so that cassandra-cluster-callback works?

octahedrion15:08:56

the Datomic Cloud documentation on functions & java methods suggests you can return variables created in queries from the :find clause, but it's not working for me: I have ?d , a :db/txInstant which I'm trying to return from :find [?i] using [(.toInstant ^java.util.Date ?d) ?i] but the query hangs & eventually returns a Datomic client exception

marshall15:08:49

@octo221 what’s in your datomic Cloud logs

jdkealy15:08:41

Hi, I've been running into transaction timeouts (the transactions do end up succeeding). I've been using transact and am reading i need to switch to transact-async. What would the benefit be of calling transact-async and then deref'ing it right away? Is it that I could boost the timeout time for these instances? If my transactor had a timeout of 5 seconds, and I deref'd the async tx with a 5 second limit, would the result be the same ?

jdkealy15:08:30

I believe, however, i need to rethink my implementation, batch the transactions, return some kind of temp id and then query for them. That's the right way to deal with this ?

eoliphant12:08:32

You can boost the timeout, or use smaller batches. Have you checked out the core.async/ pipelining approach in the best practices section? That might also fit your usecase

jdkealy13:08:14

Yes, it's just unclear to me when making a record, how to return the record to the user when they make a new post.

brycecovert15:08:59

When you’re building new schema in development mode, is there a way to retract schemas? Simple example is that I accidentally used bigint instead of long, but it seems like the only way to undo my mistake is to create a whole new database.

brycecovert15:08:14

In the documentation it says, “breakage is at best a dev convenience” — i need that convenience. 😉

Joe Lane15:08:16

A Datomic Schema is just a series of attributes, which themselves, can be retracted. If its a dev mode schema just retract the attribute. Take a look a the day of datomic cloud source repo on github (dont have the link handy rn)

brycecovert15:08:46

I’ll take a look at it. thanks.

brycecovert16:08:29

Hmm. It seems like you can’t retract schema:

@(d/transact (d/connect uri)
             [[:db.fn/retractEntity :vendor/mistake]])

brycecovert16:08:41

:db.error/invalid-alter-attribute Error: {:db/error
   :db.error/unsupported-alter-schema, :attribute :db/cardinality,
   :from :db.cardinality/one, :to :disabled

Joe Lane18:08:31

are you using cloud or on prem?

Joe Lane18:08:54

Oh, wait, do you have any records using :vendor/mistake?

marshall18:08:22

schema cannot be retracted

marshall18:08:32

if absolutely necessary, you can rename an attribute

marshall18:08:41

then create a new one with the original name and whatever change you were wanting

marshall18:08:05

this is squarely in the realm of dev-time; i wouldn’t recommend doing that in any kind of prod environment

Joe Lane18:08:36

👍 good to know, thanks marshall.

curtosis18:08:17

probably forgetting something dumb, but do I need to do anything special to pass an eid into a query?

curtosis18:08:59

I’m getting back :db.error/invalid-lookup-ref Invalid list form: []

curtosis18:08:53

but my query is :where [?ref :org/location ?eid] and I’m passing in a known-good eid as ?eid.