by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Joakim Repomaa
@repomaa
hey! i have a JSON::Any field and i'm getting the following error when using it: The Eeschema documentation describes this intermediate netlist and gives examples
lol
paste fail
this: Unhandled exception: :data type must be one of String, Int64, Int32, Int16, Float32, Float64, Bool, Time, (Int32 | Int64), (Float32 | Float64), JSON::Any, (Int16 | Int32 | Int64 | Int8 | String | Nil), Array(String), Array(Int64), Array(Int32), Array(Int16), Array(Float32), Array(Float64), Array(Bool), Array(Time), Array(Int32 | Int64), Array(Float32 | Float64), Array(JSON::Any), Array(Int16 | Int32 | Int64 | Int8 | String | Nil) (Crecto::InvalidType)
which is weird because it is one of those types since JSON::Any is listed
Joakim Repomaa
@repomaa
my bad
had to use Json as type
Gian D
@fusillicode_twitter
hi guys sorry for the bother :(
I'm getting Unhandled exception: cannot execute UPDATE in a read-only transaction when I try to perform an update via Repo.update!(record)
But I'm not using any transaction in my code 🤔
I've also tried Repo.update(record) (i.e. without the !) but unfortunately the result doesn't change
Jon
@faultyserver
could it be a database set up thing?
like your user doesn't have permissions to write to the database/table?
i don't actually know what error would be raised in that case, but it might be that?
Gian D
@fusillicode_twitter
@faultyserver somehow the problem seems to be related to running inside a docker container 🤔
Nick Franken
@fridgerator
@jreinert I added a section to the docs for the "grouped wheres" feature, let me know if this look good : https://www.crecto.com/crecto-repo-query#nested-grouped-queries
Zach Baylin
@zbaylin
Hey guys -- not sure if this is expected behavior, but whenever I use #distinct(x) on a query with Crecto, only that field x is SELECTed. I tried to override this with #select([*]) but that didnt fix it. Is this a bug or am I querying wrong?
right now I'm fixing this using the #uniq method for arrays but I assume this is measurably slower than the PSQL implementation
Nick Franken
@fridgerator
try using group_by, does that give desired results? https://www.crecto.com/crecto-repo-query#group_by
Zach Baylin
@zbaylin
shoot did I ask before -- very sorry I must have forgotten
ah looks like I did -- again my apologies
yeah I guess I'm looking for Postgres' DISTINCT ON. I never realized the differentiation.
Nick Franken
@fridgerator
no worries :thumbsup:
Joakim Repomaa
@repomaa
@fridgerator LGTM!
Joakim Repomaa
@repomaa
@fridgerator i have a really worrying bug in an api i'm developing using crecto... I'm still narrowing it down but it might be a crecto bug or even a db/pg bug :/ I get differing results for same (api) queries even though no write operations have been made on the db. It's very inconsistent. sometimes it works correctly 3 times in a row, sometimes every second query is incorrect. The actual db query is pretty complex: https://p.jokke.space/BAfEg/ what is inconsistent is the result of the source_relations preload. Sometimes it has less items, sometimes more. If you have the slightest hint of an idea what might be going on, your help would be immensly appreciated. (or anyone else's who stumbles upon this message)
Joakim Repomaa
@repomaa
sorry, that was incomplete. here's the whole thing: https://p.jokke.space/a2nVCv/
Joakim Repomaa
@repomaa
Here's how the code is translated to actual queries (from the log): https://p.jokke.space/VOAld/
Joakim Repomaa
@repomaa
Okay... narrowed it down a bit.. Here's where it starts to get weird: https://p.jokke.space/ng3vq1/
I replaced the preload from crecto with a "manual" preload on my end: https://p.jokke.space/Q1f7nz/
Joakim Repomaa
@repomaa
The missing hash key id is nowhere to be seen in the previous pg queries... In fact. It's a complete ghost
it's nowhere in the whole database
i have no idea where that id comes from
Joakim Repomaa
@repomaa
i don't generate the id for new items anywhere in the application code either but rather by setting the columns DEFAULT to postgres' own uuid_generate_v4()
Joakim Repomaa
@repomaa
Narrowed it down a bit more. The id is somehow off by the last byte. If you search this paste https://p.jokke.space/ng3vq1/ for 23ba3dba-0f79-47f9-b2d4-26dd4f7317 you will get two matches. One of which is the missing key error and the other being actually used in the query before. They only differ by the last two characters.
I think my only work around will be to use string instead of native uuid as the keys and generate them in the application code... Looking forward to that migration...
Joakim Repomaa
@repomaa
yup. migrated, and the bug is gone. also using the builtin preload now.
Nick Franken
@fridgerator
Hey just seeing all this
Nick Franken
@fridgerator
Is there some issue using uuid then?
Joakim Repomaa
@repomaa
this is pretty serious imho and worth digging into but i don't have time. Yeah it seems to be a problem with the binary representation of the uuids.
Joakim Repomaa
@repomaa
especially since it's so hard to reproduce :/
Nick Franken
@fridgerator
@jreinert were you able to get the gitlab pipline setup? I invited you as a member for the Crecto organization
Zach Baylin
@zbaylin
hey everyone -- I was pretty sad to see that Crecto is no longer being maintained. Is there a suitable alternative @fridgerator would recommend?
Joakim Repomaa
@repomaa
Heya!
@fridgerator sorry, the past months have been total chaos. Wedding and work. :P
i picked up where i left off and currently the sqlite is failing: https://gitlab.com/Crecto/crecto/-/jobs/229780954
@zbaylin don't give up hope. I'm using crecto in production in a few projects I'm invested in keeping it running. I also have more time on my hands now so I'm optimistic to get it to work with the latest version of crystal.
Nick Franken
@fridgerator
Dont know if anyone cares anymore, but I got Crecto working with the latest version of Crystal 0.30.1
Nicolas Talle
@Nicolab

Hello

Please, how to define a string enum field?

More details here: Crecto/crecto#241
Nicolas Talle
@Nicolab
:(