Baron_ThoughtEvolution
Baron_ThoughtEvolution
DTDrizzle Team
Created by Baron_ThoughtEvolution on 12/21/2024 in #help
Unable to use db.query... functions
Following is the documentation for performing queries: import * as schema from './schema'; import { drizzle } from 'drizzle-orm/...'; const db = drizzle({ schema }); The issue is that doesn't include any connection/credential information so it fails. It does see my schema information as evidenced by code completion but obviously won't work without connection info. If I define DB as this: import 'dotenv/config'; import { drizzle } from 'drizzle-orm/node-postgres'; // You can specify any property from the node-postgres connection options const db = drizzle({ connection: { connectionString: process.env.DATABASE_URL!, } }); It will connect successfully but I don't have any db.query...functions available (which is looking for a schema). I can db.select successfully. It seems it just doesn't see the schema. I'm not sure how to combine both of these into one db export. Ideally it would just reference what is already defined in the drizzle.config.ts file, but I don't know how to do that either.
3 replies