Luxaritas
Luxaritas
DTDrizzle Team
Created by sunshne2263 on 12/25/2023 in #help
Help Needed: Adding Message Count and Filtering by UserId in DB Query
If you don’t care about that, you can do it that way, though you need to aggregate by user yourself, and count in JS
7 replies
DTDrizzle Team
Created by sunshne2263 on 12/25/2023 in #help
Help Needed: Adding Message Count and Filtering by UserId in DB Query
Which means you’re returning a lot of duplicate data (the companion info is returned multiple times)
7 replies
DTDrizzle Team
Created by sunshne2263 on 12/25/2023 in #help
Help Needed: Adding Message Count and Filtering by UserId in DB Query
Well in that case, you have one row per message instead of one row per user
7 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Unfortunately I need to go offline for a while. Good luck in your debugging in the mean time
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Try what I’m suggesting. Get the SQL query from drizzle and execute that query against the database directly
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
So you got the SQL query, the SQL looked reasonable, and running the SQL text directly returned no data?
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
And what was the results?
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
(Btw you don’t need to call .execute directly, awaiting the query will do that anyways)
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Instead of calling .execute, call .toSQL (and don’t await). That will give you the query
57 replies
DTDrizzle Team
Created by sunshne2263 on 12/25/2023 in #help
Help Needed: Adding Message Count and Filtering by UserId in DB Query
You’ll need to use something like JSON_AGG/JSON_ARRAYAGG/JSON_OBJECTAGG
7 replies
DTDrizzle Team
Created by sunshne2263 on 12/25/2023 in #help
Help Needed: Adding Message Count and Filtering by UserId in DB Query
Drizzle (and SQL in general) doesn’t let you pass a table to select all fields as an array
7 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Something else you could consider doing is logging the SQL query with toSQL (or the drizzle query logging feature), inspecting it to see if anything looks off, and running that query directly (maybe with CLI? assuming vercel db lets out do that)
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Ok, thanks for helping me understand your debugging steps
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Using a DB browser of some sort?
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
How did you do this
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Like how did you verify that your products table actually did not have a row with that session value?
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Ok, and how about the contents of the table?
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Like you said you checked the data, did you do that via something like the pg cli?
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
Not how the API does it
57 replies
DTDrizzle Team
Created by Mojo Edits on 12/23/2023 in #help
trying to retrieve data
I mean when you’re manually checking these things
57 replies