Fork me on GitHub
#datomic
<
2020-03-13
>
marcelo.piva01:03:24

Hi, any opinions on using fully namespaced spected keywords as datomic attributes? Like org.domain.entity/attribute?

onetom06:03:29

as opposed to what alternative?

marcelo.piva06:03:57

just :entity/attribute.

marcelo.piva06:03:52

One issue that I’ve found is trying to spec ref attributes, where I can have the actual entity or a lookup ref when transacting. It’s seems a bit weird to have the domain this close to a db spec.

onetom06:03:46

can u give a specific example of that spec situation? this sounds like an interesting problem. i was also wondering about what is a good naming scheme for specs. for now i just went with the problem-domain-entity-name/attr style, and my namespaces dealing with those attributes are <company-short-name>.<project-name>.data.<problem-domain-entity-name> or maybe don't even have the .data part if the project is simple enough.

onetom07:03:04

eg: company internet domain: https://gini.co project name: rule-crib domain entity terminology: financial transaction domain entity name: txn (as opposed to tx, which we kept to refer to Datomic transactions) NS: gini.rule-crib.txn Datomic attribute: :txn/descr I've also tried to just have gini.txn, but it's easy to get lost between projects within a monorepo, where different projects might deal with different aspects of the same domain entity...

favila10:03:21

Imo it’s not appropriate to spec txdata for d/transact. The spec for transaction data is the spec for the transaction dsl, not for its keys

favila10:03:57

So a transaction map is a s/map-of, not an s/keys

favila10:03:20

the spec for keywords should be what you would get in pulls

marcelo.piva14:03:36

Cool, I’m sharing this opinion now. What do you think about the namespaces? There is a lot of boilerplate when converting between them, having the same attributes internally and in datomic solves some of the issue. Wire Internal Datomic :attribute <-> org.domain.entity/attribute <-> :entity/attribute

favila14:03:35

I prefer sharing keywords, but keyword length fatigue is real

favila14:03:54

I’d drop “org” though, unless you already have a strong code convention around that

favila14:03:38

If you can somehow maneuver your data keyword namespaces to be actual namespaces (maybe put specs there? idk) your life will be much better, or at least not have as much keyword typing in it

marcelo.piva15:03:25

I’m doing that, the actual length is not an issue (only in repl things get polluted sometimes). Our convention is to wire unnamespaced between services, but it’s not hard to namespace all things, the issue is more between internal and datomic schemas.

marcelo.piva15:03:54

About the org, we thought on using it because it would be clearer when it’s an external data from a provider, for example.

favila18:03:39

:org.domain.otherorg.entity/attribute maybe?

👍 4
onetom06:03:56

Is there a way to get the database URI back from a datomic.Connection (or datomic.peer.Connection)?

onetom06:03:56

If not, is there a reason for it? Eg. not to keep connection secrets for a DynamoDB connection around for long (when someone is using the not-recommended non-role based uri)? It would be convenient to obtain a connection URI back from a conn, when creating a Datomic component using some state management library, like component / mount / juxt/clip. It could simplify the stop operation, which can automatically clean up in-memory test databases with random names for example...

rossputin09:03:56

morning folks - just testing my thinking... if I accidentally deferred giving my datomic compute instance an application name during template setup etc (working through the ion tutorial) - would I be right in thinking there should be a way to give a value to that parameter in AWS console ? Thanks.

marshall13:03:17

It will automatically get the application name of the compute group, but you can also change it by doing an “update stack” in the cloudformation console

Alex17:03:58

this may be a dumb question but if you're querying with a vector of values is there a way to count how many values in a muli-valued attribute you matched on?

favila18:03:29

you can in the result with distinct or count-distinct depending on how you aggregate

favila18:03:45

you can’t within the query easily without a function call or subquery

favila18:03:34

[:find ?e (count-distinct ?v) :in $ [?v …] :where [?e :attr ?v]]

hadils23:03:56

I want to use Java 11 lambda ions in Datomic Cloud. My IDE and libraries are set up for Java 11 on my local machine, but it still deploys Java 8. Any suggestions?

ghadi23:03:47

"Lambda ions" don't actually run in AWS Lambdas

ghadi23:03:25

the lambdas are cookie-cutter forwarding proxies that talk to the compute group, which actually runs your code

ghadi23:03:58

that way your code runs with the full database essentially "local"

ghadi23:03:16

once a machine is hot, it scorches

ghadi23:03:52

Not sure what the timeline is on Java 11 support. I'm sure it's on the roadmap but not sure where

ghadi23:03:06

no problem

ghadi23:03:20

not sure if there is a diagram of how this all works somewhere

ghadi23:03:42

diagram near the top

ghadi23:03:14

incidentally I have been working on a AWS Lambda custom runtime for clojure -- as a separate effort

ghadi23:03:50

can run Java 14 in the Lambda, where your function handler is an ordinary var that gets called with ordinary maps as arguments, and returns a map

ghadi23:03:07

can set clojure.core/merge as a valid lambda handler

ghadi23:03:32

it's like 100LOC + 25MB for the JVM

ghadi23:03:44

no silly macros to do the silly java interop

ghadi23:03:39

@hadilsabbagh18 is there something from Java 11 that you really really want to use?

ghadi23:03:22

Personally I like the http://java.net.http client being available. Cuts down on a lot of deps.

hadils23:03:42

No, I was hoping to get a little more speed out of the JVM. Want to use the latest and greatest before going to Production.