https://supabase.com/ logo
Join DiscordCommunities
Powered by
# javascript
  • s

    silentworks

    10/05/2021, 8:17 PM
    Group by specific column
  • j

    javorszky

    10/06/2021, 7:25 PM
    hey, can someone help me with the join tables bit of
    supabase.from('table').select( ... )...
    how do I specify what tables I want to select from, what columns they're joined by, whether it's an inner or outer join. The docs are somewhat confusing here
  • j

    javorszky

    10/06/2021, 8:09 PM
    rpc it is πŸ™‚
  • s

    Scott P

    10/06/2021, 9:08 PM
    We had a discussion about how to do this some time ago - there's an example here (https://discord.com/channels/839993398554656828/869406062036529193/888521446316445737) and there's some more supporting information in the messages before it. RPC is also a good option if you're more comfortable with SQL
  • j

    javorszky

    10/06/2021, 9:09 PM
    a similar example is on the docs page, but it's still not clear what part is for what and how to do different things, and I kept getting errors about "table.column" doesn't exist
  • j

    javorszky

    10/06/2021, 9:09 PM
    rpc is better for what I want to do at the moment πŸ™‚
  • g

    gawlk

    10/07/2021, 7:36 PM
    Hi guys, I think that I’m going crazy, there is something about the doc that I must not understand correctly. How would you convert this query
    Copy code
    SELECT urls.id, urls.name, array_agg(tags) as tags
        from urls
        join urls_tags on urls.id = urls_tags.url_id
        join tags on tags.id = urls_tags.tag_id
        group by urls.id
    To a supabase query ? I came up with that but it’s not complete:
    Copy code
    await db.from(`urls_tags`).select(`urls:url_id ( id, name ), tags:tag_id ( id, name )`)
    s
    j
    • 3
    • 7
  • g

    gawlk

    10/07/2021, 7:40 PM
    Or is there maybe a way to directly use my Postgres query ?
  • s

    silentworks

    10/07/2021, 9:05 PM
    Using SQL query with supabase-js
  • n

    Null

    10/07/2021, 10:41 PM
    Copy code
    js
    const image = useRef()
    
    const file = image.current.files[0];
    const { data, error } = await supabase.storage.from("image-posts").upload(file, {
      cacheControl: "3600",
      upsert: false,
      });
    if (error) alert(error);
    I cant seem to upload an image to a storage bucket, i get the error "[object Object]". And the image variable reference is being used on an
    <input type="file"/>
    .
  • s

    seufernandez

    10/07/2021, 10:45 PM
    Hi!!πŸ‘‹πŸ‘‹ Anyone know a way to search through multiple column? I tried this below but has not worked haha πŸ˜…
  • g

    garyaustin

    10/07/2021, 10:52 PM
    Looks like you are missing a pathname in the upload() before the file object.
  • s

    seufernandez

    10/07/2021, 10:53 PM
    I thought about making 2 req to get both results and use concat() to merge then but I realize it would bring some duplicated rows
  • n

    Null

    10/07/2021, 10:55 PM
    path of what/where exactly?
    g
    s
    • 3
    • 41
  • s

    seufernandez

    10/07/2021, 11:04 PM
    if anyone know a way to make this req on NEXTjs helps as well haha
  • d

    danestves

    10/08/2021, 1:23 AM
    I'm trying to signIn but i'm always receiving this error, i don't know what it is :/
  • d

    danestves

    10/08/2021, 1:31 AM
    Oh i see the error, i'm putting this on the function and i get this error
    ERROR: column \"student:basic\" does not exist (SQLSTATE 42703)"
    how can i fix that?
  • j

    jason-lynx

    10/08/2021, 2:07 AM
    you'll need to use single quotes if you want to insert strings
  • j

    jason-lynx

    10/08/2021, 2:08 AM
    double quotes are for postgres idenfiers: https://stackoverflow.com/questions/41396195/what-is-the-difference-between-single-quotes-and-double-quotes-in-postgresql
  • d

    danestves

    10/08/2021, 3:27 AM
    It works! Thanks!
  • g

    gawlk

    10/08/2021, 8:00 AM
    Could anyone help me please ?
  • g

    gawlk

    10/08/2021, 8:02 AM
    Is there really no way to do a join via the library ?
  • y

    YelloJello

    10/08/2021, 10:07 AM
    i don't think your query would run tbh, you can do a join via supabase-js but afaik only if you have a reference to the table you want the join to happen in via a foreign key on the table you want to join from. could be wrong, i stopped using the client lib a long time ago. why don't you create a view and then just fetch that via the client lib?
  • g

    gawlk

    10/08/2021, 11:01 AM
    Thank you for your answer ! What do you mean by creating a view ?
  • y

    YelloJello

    10/08/2021, 11:44 AM
    https://www.postgresql.org/docs/current/sql-createview.html, it's like creating a mask with a bunch of holes so you can only see certain things. you can't change what it's in the view itself
  • g

    gawlk

    10/08/2021, 11:48 AM
    Awesome ! Thank you very much
  • a

    Adnane

    10/08/2021, 3:59 PM
    Hey do you have document that explain how to structure the supabase tables ?
  • s

    Scott P

    10/08/2021, 4:53 PM
    The document would just say "It depends". What works for one project may not work for other projects.
  • a

    Andy | Spillhosting.no

    10/08/2021, 7:02 PM
    Is there any rate limiting? I keep getting:
    Copy code
    type: 'system',
    errno: 'ETIMEDOUT',
    code: 'ETIMEDOUT'
  • a

    Andy | Spillhosting.no

    10/08/2021, 7:12 PM
    Restarting the server fixed it, is there any way to prevent this for the future?
1...242526...81Latest