Drizzle TeamDT
Drizzle Team2y ago
14 replies
Jackson Kasi

Issue Querying Table via Drizzle ORM with SQLite

Hello Drizzle Community,

I'm currently facing an issue with querying the
tbl_workshops
table in a SQLite database using Drizzle ORM. Despite confirming that the table exists and is properly structured (I can query it directly using SQLite tools), attempts to query it through Drizzle result in an error indicating that the table doesn't exist.

Error Message:
SQLITE_UNKNOWN: SQLite error: no such table: tbl_workshops


Environment:
- ORM Version: Drizzle ORM v0.29.5
- Database: SQLite
- Bun Version: Bun v1.1.0
- Operating System: win11

Code Snippet:
Here's a simplified version of how I'm setting up Drizzle and attempting to query the
tbl_workshops
table:
// db.ts
import { createClient } from "@libsql/client/http";
import { drizzle } from "drizzle-orm/libsql";
import { env } from "../env.mjs";
import * as schema from "./schema";

const client = createClient({
  url: env.DATABASE_URL,
  authToken: env.DATABASE_AUTH_TOKEN,
});

export const db = drizzle(client, { schema, logger: false });

// Query attempt
const classData = await db.query.tbl_workshops.findMany({});


I've already verified the following:
- The
DATABASE_URL
environment variable correctly points to the SQLite database file.
- The table name in the schema matches the actual table name in the database.
- I can manually query the
tbl_workshops
table using SQLite command-line tools or GUIs.

I'm puzzled about what could be causing this issue and would greatly appreciate any insights or suggestions from the community. Has anyone encountered a similar problem, or does anyone have ideas on what might be going wrong or how to troubleshoot this further?

Thank you in advance for your time and help!
image.png
image.png
image.png
image.png
Was this page helpful?