Fork me on GitHub
#datomic
<
2021-02-16
>
souenzzo13:02:36

Can I use db.attr/preds with database functions ?

Lennart Buit13:02:26

We seem to have hit a snag. We have on-prem, but we reach it with the client api. If we install a database function with a peer connection, and we (datomic.client.api) tx-range over this transaction it triggers an exception: Could not marshal response: Not supported: class clojure.lang.Delay. Similarly, if we datomic.client.api/pull the database functions ident, we get the same marshal exception, whereas datomic.api/pull (with a peer conn) returns the fn without a hich. Is this a known bug?

18
Joe Lane14:02:22

Hi @UDF11HLKC , could you file a support ticket and provide a stacktrace ( if there is one?)

Joe Lane14:02:08

Best thing you could do would be creating a secret gist, showing a minimal repro, and then send it to <mailto:[email protected]|[email protected]>

Lennart Buit21:02:15

Done, also, googling ‘datomic marshal error’ leads to a lot of comments by marshall about errors but not particularly about marshalling errors

7
Joe Lane21:02:41

Not sure I can do much about that one haha

defa14:02:06

As I understand queries with fulltext search require :db/fulltext in the schema for that particular attribute to be true. Is it possible to alter the schema of an existing database to allow fullext search? When I transact [[:db/add :my-thingy/name :db/fulltext true]] I get an error:

:db.error/invalid-alter-attribute Error: {:db/error :db.error/unsupported-alter-schema, ...
What am I doing wrong?

thumbnail14:02:24

You can rename the old attribute and create a new attribute (with db/fulltext). Here's an example: https://gist.github.com/ccfontes/3f566db393da14742a9a No experience with that approach though.

favila15:02:30

Unless this is a throwaway db that you know will never get big, I highly advise never using fulltext

favila15:02:34

it’s “easy” but it gives you very little power, and the lucene index has some catastrophic misbehavior. and as your application and db grows and maybe you move off to elasticsearch or something, there’s no way to easily get rid of this index

Phil14:02:54

I've tried really hard to find an online example of using create-database with a sql/postgres backend. I spent the entire day yesterday trying to get this to work. I'm using datomic-pro. I can create a db using the "dataomic:free" image and my own datomic pro with "datomic:mem" but no luck with a real storage backend. I can't use cloud and don't want to be forced in to dynamodb or cassandra at this point. I'm trying to sell this stack to a new (non-clojure) group so I want to lower the number of new technologies at POC time. Any examples out there?

Joe Lane14:02:42

This may interest you and your team. Appears to use postgres https://youtu.be/QrSnTIHotZE

Phil15:02:59

thanks, I give that a run-thru tonight. From a quick look, I think I was using datomic.client.api . Is it correct that only datomic.api and not datomic.client.api is required?

Joe Lane15:02:13

I'm not sure how best to answer that question @U120SKKNK, but if you're still stuck after running through that project tonight (BTW, the source is linked in the video descriptioin) reach out and we can figure out what's going on, sound good?

Phil16:02:46

I watched more. Excellent resource. Thanks @U0CJ19XAM

Phil12:02:19

Answering my question above re on-prem and create-database https://docs.datomic.com/client-api/datomic.client.api.html#var-create-database > > NOTE: create-database is not available with peer-server. > Use a Datomic Peer to create databases with Datomic On-Prem.

Michael Stokley20:02:55

:db/doc is a way to annotate an attribute. can i annotate an assertion?

Joe Lane20:02:58

Hey @U7EFFJG73, any reason you don't want to make your own attribute like the example you referenced?

Michael Stokley20:02:02

Joe, no, I'm not opposed to creating new attributes

Joe Lane20:02:56

I think I'm not understanding your question...

Michael Stokley20:02:38

I'm about to un-deprecate at attribute of ours and I'd like to include some comments about why - specifically, why we're changing our mind about the deprecation. :db/doc doesn't seem appropriate, since it's per attribute (i think).

Michael Stokley20:02:24

including the comments against the transaction entity would work, too.

Michael Stokley20:02:11

i'm just curious whether i could go even more fine grained and include a comment against a specific assertion within a transaction. that was my original instinct, before i knew about the per-transaction annotations.

Michael Stokley20:02:18

am i making any sense?

Joe Lane20:02:37

I would attach either your own attribute or db/doc to the transaction entity if I was in your case. I think I understand the question. It's about documenting a change about 1 of n assertions within a transaction. Specifically, can you reify and individual assertion within a transaction of many assertions, right?

Michael Stokley20:02:30

yep! and per-tx is perfect. sounds like assertions are not reified in the same way, which is fine.

Joe Lane20:02:01

Great, does this resolve things then?

🙌 3
Joe Lane20:02:40

Great 👍 Always nice to hear from you @U7EFFJG73!