iolyd
DTDrizzle Team
•Created by iolyd on 6/6/2024 in #help
Drizzle-zod errors
Yeah, I should've posted how I fixed it for posterity. It was also due to a circular reference on my side where I was importing and using a reference to a table column in a file that also exported constants used to define said table column. Honestly the logs were of 0 help here.
4 replies
DTDrizzle Team
•Created by xxxxx on 5/2/2024 in #help
add a prefix to UUID?
For a schema level implementation, you could probably get it working with something along the lines of
8 replies
DTDrizzle Team
•Created by iolyd on 1/20/2024 in #help
Less verbose generic types for helper functions
You can look at the source and copy what you want (or you can install the package but I'm still changing things quite a lot so i'd say its a bit unstable)
10 replies
DTDrizzle Team
•Created by iolyd on 1/20/2024 in #help
Less verbose generic types for helper functions
Yeah, i made a package with various type / query helpers to help me reuse some wrappers across projects: https://github.com/iolyd/drizzle-orm-helpers
10 replies
DTDrizzle Team
•Created by iolyd on 11/2/2023 in #help
Get subquery columns in a way similar to `getTableColumns`
Good question, I personally didn't end up having cases where I had to use it, but I still think it could be useful for others.
12 replies
DTDrizzle Team
•Created by James on 1/17/2024 in #help
Extract type from SubQuery
Couldn't agree more, imho the typing system currently is excessively hermetic, inconsistent across query types, and poorly documented. With earlier versions I even faced situations where accessing certain types required using
Symbol
s that drizzle didn't even expose. But I have to say that now things are getting better, and the fact you can achieve almost anything with sql
tagged template literals is super appreciated on my part.24 replies
DTDrizzle Team
•Created by James on 1/17/2024 in #help
Extract type from SubQuery
@Gary, el Pingüino Artefacto Those are some types I made, sorry I forgot to include them!
24 replies
DTDrizzle Team
•Created by James on 1/17/2024 in #help
Extract type from SubQuery
With modified types for the
jsonAgg
helper I can confirm passing subqueries should work as expected:
Note that I haven't tested queries with aggregated non-aliased subqueries (Any[dialect]Select
) through drizzle, so I don't know if it's valid that I also handle these. But db.select().from().as()
subqueries work without problem!24 replies
DTDrizzle Team
•Created by iolyd on 11/2/2023 in #help
Get subquery columns in a way similar to `getTableColumns`
Personally my vote goes to striving for making things less specific and providing a single helper. This PR should answer most use case: https://github.com/drizzle-team/drizzle-orm/pull/1789
12 replies
DTDrizzle Team
•Created by James on 1/17/2024 in #help
Extract type from SubQuery
In this case, the generic type of
jsonAgg
would need to be expanded a bit to account for Subquery
24 replies
DTDrizzle Team
•Created by James on 1/17/2024 in #help
Extract type from SubQuery
Hard to test without a db I can hit, but I feel something like this should work:
24 replies
DTDrizzle Team
•Created by iolyd on 1/20/2024 in #help
Less verbose generic types for helper functions
With simplified types:
10 replies
DTDrizzle Team
•Created by iolyd on 1/20/2024 in #help
Less verbose generic types for helper functions
Step one to help work with subqueries for me is to provide a config getter:
10 replies
DTDrizzle Team
•Created by iolyd on 1/20/2024 in #help
Less verbose generic types for helper functions
Do you have an example of wrapper function you'd plan on working with? It could maybe help me sketch out more robust type helpers
10 replies
DTDrizzle Team
•Created by James on 1/17/2024 in #help
Extract type from SubQuery
@Angelelz do you know if there's a plan for drizzle to provide such helpers of their own?
24 replies
DTDrizzle Team
•Created by James on 1/17/2024 in #help
Extract type from SubQuery
Small warning if you go this route: generic types can get a bit messy when you want helpers to handle not only table arguments but also subqueries (
Subquery | SubqueryWithSelection | WithSubqueryWithSelection
and etc.)24 replies
DTDrizzle Team
•Created by James on 1/17/2024 in #help
Extract type from SubQuery
You could also build
sql
helpers with generic types for the various sql functions you use to avoid you the trouble of manually typing things every time you want to do things like json_agg
, row_to_json
, etc. I'm using something like this in a project of mine, maybe this could help?
24 replies
DTDrizzle Team
•Created by iolyd on 11/23/2023 in #help
Malformed migration file
Ah nvm, I think its related to the fact I was using a pkg patch for https://github.com/drizzle-team/drizzle-orm/issues/636 and haven't repatched after updating so the patched-in
schemaTo
props are unexpected in the metadata5 replies
DTDrizzle Team
•Created by iolyd on 11/2/2023 in #help
Get subquery columns in a way similar to `getTableColumns`
12 replies