Noahh
DTDrizzle Team
•Created by Noahh on 8/23/2023 in #help
Missing @opentelemetry/api module at runtime when upgrading to 0.28.4
Just upgraded
drizzle-orm
to 0.28.4
, and running my project (after a successful typecheck) I get the error Cannot find module '@opentelemetry/api'
. Here is the full stack trace:
For reference I'm using PNPM and CJS55 replies
DTDrizzle Team
•Created by Noahh on 7/5/2023 in #help
PostgreSQL RQB truncation
I have a fairly nested query using the RQB and I'm running into issues where PostgreSQL truncates the identifiers used to 64 characters (as it normally does). In wondering if it makes sense/if there is a way to make the identifiers used in the RQB always fit into the 64 character limit because the truncation results in duplicate identifiers and makes the query fail. I am happy to send an example schema/error if that makes anything easier.
1 replies
DTDrizzle Team
•Created by Noahh on 6/22/2023 in #help
Filtering findMany using related records
I have a
restaurants
table that has a one-to-one relation with an addresses
table. I want to pull all of the restaurants and their address within specific lat/long bounds, but I'm struggling to figure out how to do that. A simplified version of what I want/have so far
I'm trying to figure out if this is somethin Drizzle can do or if I need to break into using sql`` to do it19 replies
DTDrizzle Team
•Created by Noahh on 6/17/2023 in #help
drizzle-kit generate:pg throws ERR_INVALID_RETURN_PROPERTY_VALUE
I have my
drizzle.config.ts
file unchanged (besides adding driver
) from before the recent update (see below), but after updating to latest I am getting an error: TypeError [ERR_INVALID_RETURN_PROPERTY_VALUE]: Expected a url string to be returned for the "url" from the "drizzle-kit/loader.mjs 'resolve'" function but got instance of String.
11 replies
DTDrizzle Team
•Created by Noahh on 5/22/2023 in #help
Duplicate relations when using `with`
I'm running into a problem where some duplicate values are being returned through a relation with
with
.
Basically, I'm getting
instead of
You can see that all of the ids are duplicates. I know I ran into this plenty when I was doing my own joined queries, but am I doing something wrong here?
My query is
Any help is appreciated, I'm hoping to have this functional sometime tomorrow :) Thanks in advance!26 replies
DTDrizzle Team
•Created by Noahh on 5/9/2023 in #help
Using with NestJS and Zod
I'm trying to use
drizzle-zod
and nestjs-zod
together to create Zod schemas and classes for insert and select. I mostly got it to work, even with Swagger! However, I'm running into a problem with one of the create schemas. My table is defined:
Then I create the Zod schema for inserting
And then I turn that into a class
However, when I try to do something like
I get Property 'firstLine' is optional in type 'NewAddress' but required in type '{ firstLine: string | SQL<unknown> | Placeholder<string, any>;...
. Looking at the generated class, every property has ?
after it, and I'm not sure if that's a drizzle-zod
problem or a nestjs-zod
problem.
Any information would be awesome, thanks! So far I'm loving using Drizzle2 replies
DTDrizzle Team
•Created by Noahh on 5/9/2023 in #help
Typing columns based on Table
I'm trying to make a generic
paginateQuery
function that would let me pass in the table and then an array of only columns from that table would be accepted. Is there any way to do this with the Drizzle types? I feel like I have gotten close a few times but nothing fully gets there. Thanks!
4 replies
DTDrizzle Team
•Created by Noahh on 5/8/2023 in #help
Does onConflictDoUpdate work with composite primary keys?
I have a model defined below:
I want to upsert a row into this table but I'm not sure how to set
target
to the composite primary key. Is this possible?
3 replies