warflash
warflash
Explore posts from servers
DTDrizzle Team
Created by joshborseth on 9/14/2023 in #help
TypeError: Cannot read properties of undefined (reading 'compositePrimaryKeys')
Any workaround for the compositePimaryKeys issue perhaps? Not being able to generate migrations is a real pain 🙏
44 replies
DTDrizzle Team
Created by terryball on 11/15/2023 in #help
Chaining/combining $dynamic query functions
Okay yeah that seems to actually be the case. That's kind of crazy. Like how would one go about doing
select
*,
sum(ratingTable.rating) as rating
from myTable
left join ratingTable (logic here)
group by myTable.id
order by rating desc
select
*,
sum(ratingTable.rating) as rating
from myTable
left join ratingTable (logic here)
group by myTable.id
order by rating desc
then, where the selected field is not part of any table definition :confus:
10 replies
DTDrizzle Team
Created by terryball on 11/15/2023 in #help
Chaining/combining $dynamic query functions
Thank you! This is all pretty close to what I already have actually, the only difference is the sortMap. Does that mean you can't actually simply do asc(sql'${mySortByParamFromApi}')? Creating a manual map for every query seems very cumbersome 🤔
10 replies
DTDrizzle Team
Created by terryball on 11/15/2023 in #help
Chaining/combining $dynamic query functions
Just stumbled across this, would you mind sharing your withOrderBy function and what/how you pass the base query in? Tried achieving the same but failed miserably 🙏
10 replies
DTDrizzle Team
Created by James on 1/17/2024 in #help
Extract type from SubQuery
Thanks for sharing and I very much appreciate the update! I really hope improvements in that regard land in the repo itself sometime down the line as at the moment the DX with anything complex really is not there yet. I feel like and you spend more time fighting types and working around things than actually writing queries. But we'll put that to great use in the meantime
24 replies
DTDrizzle Team
Created by James on 1/17/2024 in #help
Extract type from SubQuery
SELECT authorsTable.id, authorsTable.name,
(
SELECT json_agg(sub_articles)
FROM (
SELECT id, name, content
FROM articlesTable
-- Looking for a way to add this clause, referencing the outer table in the subquery we inject like in your example
WHERE articlesTable.author_id = authorsTable.id
) AS sub_articles
) AS articles
FROM authorsTable;
SELECT authorsTable.id, authorsTable.name,
(
SELECT json_agg(sub_articles)
FROM (
SELECT id, name, content
FROM articlesTable
-- Looking for a way to add this clause, referencing the outer table in the subquery we inject like in your example
WHERE articlesTable.author_id = authorsTable.id
) AS sub_articles
) AS articles
FROM authorsTable;
24 replies
DTDrizzle Team
Created by James on 1/17/2024 in #help
Extract type from SubQuery
@iolyd Have you by chance ever run into this usecase as well? The pattern looks so close to what we're looking for and where doing without an ORM but the final piece of the puzzle seems to be missing
24 replies
DTDrizzle Team
Created by James on 1/17/2024 in #help
Extract type from SubQuery
Quick question, like I said we're looking to do a similar pattern. However I'm curious how you would pass data to that subselect. Like if you wanted to filter for a specific author in your example then adding the where clause to authors is easy. However for articles by that author that seems impossible to do? We've been banging our heads against the wall for days now and can't find a nice solution unfortunately
24 replies
DTDrizzle Team
Created by eatmoose on 10/5/2023 in #help
GIN index
Hey, have you ever figured this one out? Having the same struggles right now :/
2 replies
DTDrizzle Team
Created by James on 1/17/2024 in #help
Extract type from SubQuery
Perfect coincidence as that's just what we're looking for as well. Trying to define different subqueries and merge them into a final output using json_agg. Native support would be very nice though I do have to say 😅
24 replies
DTDrizzle Team
Created by Liam on 6/16/2023 in #help
Using PgArray
.text().array()
2 replies
DTDrizzle Team
Created by hachoter on 6/12/2023 in #help
What's the overhead (if any) of using the new relational api?
But naturally there will be overhead in most cases compared to manually written queries as auto generated ones can't be as refined
10 replies
DTDrizzle Team
Created by hachoter on 6/12/2023 in #help
What's the overhead (if any) of using the new relational api?
It still only sends one query to the database
10 replies
DTDrizzle Team
Created by warflash on 5/5/2023 in #help
TS query types dont match + no return types
Subscribed, appreciate it!
7 replies
DTDrizzle Team
Created by warflash on 5/5/2023 in #help
TS query types dont match + no return types
That's interesting. It does seem to work with the setup I have right now for some reason 🤔 We have 2 databases we need to connect to and as far as I can tell it works as expected. Is proper multi instance support something that is planned then? Couldn't find an open issue for it so figured I'd ask :)
7 replies
DTDrizzle Team
Created by warflash on 5/5/2023 in #help
TS query types dont match + no return types
ah great call, yeah making sure all versions are the same across projects indeed got rid of the type error. Thank you 🙏
7 replies
DTDrizzle Team
Created by warflash on 5/3/2023 in #help
Tables are not being generated
ooh it seems like the migrationsfolder path needs to be from the project root instead of relative to where it's being called from
6 replies
DTDrizzle Team
Created by warflash on 5/3/2023 in #help
Tables are not being generated
6 replies