Code Monkey home page Code Monkey logo

Comments (9)

jan-tennert avatar jan-tennert commented on June 12, 2024

On which method? And what do you mean with no longer working?

from supabase-kt.

MohamedRejeb avatar MohamedRejeb commented on June 12, 2024

builder.select(columns = Column.raw("*, profile(*)"))
Before this was returning the data with a populated profile, with 2.0 the profile is returned as an id, and I'm getting an error in serialization saying that object is expected but found string instead. So it seems like the profile is not populated.
I managed to fix this by listing all the fields: Column.raw("id, name, profile(id, first_name, age)") but I have a lot of fields, I prefer using the star it's easier to read and maintain.

from supabase-kt.

jan-tennert avatar jan-tennert commented on June 12, 2024

Can you show the full error? I just tried something similar and it works perfectly fine:

val result = supabase.from("products").select(Columns.raw("*, shops(*)"))
println(result.data) //the objects contain all fields

from supabase-kt.

MohamedRejeb avatar MohamedRejeb commented on June 12, 2024

The code:
Screenshot 2024-01-09 at 3 21 03 PM

Here's the error:
Screenshot 2024-01-09 at 3 18 13 PM

from supabase-kt.

jan-tennert avatar jan-tennert commented on June 12, 2024

Is primary_image actually a table? You have to specify the table and it postgres will automatically look for relationships and then fills in the data. (See https://supabase.com/docs/guides/database/joins-and-nesting)

from supabase-kt.

MohamedRejeb avatar MohamedRejeb commented on June 12, 2024

primary_image is the field name, but the table name is image, in 1.x I had to use the field name, I will try to change it with the table name.

from supabase-kt.

jan-tennert avatar jan-tennert commented on June 12, 2024

@MohamedRejeb Looking at the postgrest docs, it seems like it can be both. So the problem you have is not that the data is not there rather that there are two identical json keys. Can you try that:

Columns.raw("*, primary_image_data:primary_image(*)")

Here I'm renaming the key where you have the actual data (and not the id of the data)

from supabase-kt.

jan-tennert avatar jan-tennert commented on June 12, 2024

Note that the primary_image_data will contain the data and primary_image will still be the id of the primary image. You can also try the opposite to rename the primary_image id column:

Columns.raw("primary_image_id:primary_image, *, primary_image(*)")

from supabase-kt.

jan-tennert avatar jan-tennert commented on June 12, 2024

Closing due to inactivity. Feel free to reopen!

from supabase-kt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.