DT
Drizzle TeamTwiser
TypeScript complaining about using a spread operator in partial select query
TypeScript complaining about me using a spread operator in partial select query.
I have the following query joining data on two tables,
userData
and users
. The query works as intended on the client side but TypeScript is complaining about me using a spread operator ...userData,
(line 3) with TS2345: Argument of type [...] is not assignable to parameter of type SelectedFields
I am using "drizzle-orm": "^0.28.6"
Angelelz•194d ago
You're not supposed to spread the table directly like that. Gut you can use the
getTableColumns
helper: https://orm.drizzle.team/docs/goodies#get-typed-table-columnsGoodies - DrizzleORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind
Angelelz•194d ago
Twiser•194d ago
Oh thank you so much, didn't know about this helper! This works now.
Ahmed•194d ago
I've almost switched to the query API even if the query doesn't include joins!
My issue has been resolved.
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
7.4KMembers
View on DiscordWant results from more Discord servers?
More PostsUnable to read error message when inserting withdb.insert().values()Hey there, i am using visual studio code and am developing with nuxt3. I am trying to insert an objehow to add new driver to drizzle?what is the procedure of adding a new driver to drizzle orm?`drizzle-kit --custom` is not giving me a blank migration fileI'm doing the following:
```sh
drizzle-kit generate:pg --custom
```
But it's not giving me a blankNo id returned (mysql2)```
async function create(data: NewBusiness) {
return client.insert(business).values(data)
}
```
Studio when using Turso `Error: Cannot find module 'better-sqlite3'`Error when trying to start Studio and push
`Error: Cannot find module 'better-sqlite3'`[BUG]: React Hook Form doesn't submit when using drizzle-zod to create schemes to use in zodResolverWhen using `drizzle-zod` to generate schemas from database schemas and using them in the `useForm` rAppending SQL chunks to a queryHey everyone, I'm trying to see if there is a way where I can build SQL queries conditionally (basedPostgresjs with Neon giving connnection refusal errorI am unable to connect to my neon database. I tried using `postgresjs` and the `neon serverless` drierror: column "id" cannot be cast automatically to type uuidim using drizzle, and this is my schema:
```typescript
export const tags = pgTable("tags", {
id: uinArray() using sql`` operator in JS and PostgresHey, how do I use sql operator with arrays in JS?
```javascript
const array = [1,2,3];
const sqlQuer