You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
About a weekend and some later, and I am much more confident in my driver - I feel like it's maturing, and so is the accompaning REL implementation. So, I have started to write some playground-style tests to see how far it works ... or does not.
Right now, I am trying to get related record loading to work; so let me give you the TL;DR:
DEFINE TABLE users SCHEMAFULl;
DEFINE FIELD name ON users TYPE string;
DEFINE FIELD tags ON users TYPE array<string>;
DEFINE FIELD photos ON users TYPE record<photos>;
DEFINE TABLE photos SCHEMAFULL;
DEFINE FIELD title ON photos TYPE string;
DEFINE FIELD file ON photos TYPE bytes;
That's a very basic 1:n relation. To query all users, with their photos:
SELECT * FROM users FETCH photos;
The resulting JSON will also contain the photos - as already attached objects.
This obviously isn't how the big classics, MySQL and PostgresQL behave.
The way the driver handles it, is that it returns both tags and photos as []byte.
This is demonstrated here. Unfortunately, inserting data does not work: Found NONE for field risks_rel, with record processes:Lohnabrechnung2, but expected a record<risks>. That's a SurrealDB error, and here is the query that produced that:
Is sending the field on the same function call is what you need?
Currently REL will include the field based on whether it's an association field or not. A dumb fallback now is to check if there's id field inside the record.
Hey there!
About a weekend and some later, and I am much more confident in my driver - I feel like it's maturing, and so is the accompaning REL implementation. So, I have started to write some playground-style tests to see how far it works ... or does not.
Right now, I am trying to get related record loading to work; so let me give you the TL;DR:
That's a very basic 1:n relation. To query all users, with their photos:
The resulting JSON will also contain the photos - as already attached objects.
This obviously isn't how the big classics, MySQL and PostgresQL behave.
The way the driver handles it, is that it returns both
tags
andphotos
as[]byte
.This is demonstrated here. Unfortunately, inserting data does not work:
Found NONE for field
risks_rel, with record
processes:Lohnabrechnung2, but expected a record<risks>
. That's a SurrealDB error, and here is the query that produced that:(I have some actually usable debug logging now...it helps a lot.)
The actual struct being passed is:
Is there any interface I can implement in my adapter to work with/around that?
Thank you and kind regards,
Ingwie
The text was updated successfully, but these errors were encountered: