Querying Views

I'm currently trying to query a view, but im getting an error back.

export const runTest1 = async () => {
  try {
    // Run a query to the jotform_wm_item_file view to return the first 100 items
    const results = await db.select().from(sql`${jotform_wm_item_file}`).limit(100);
    console.log(results);
  } catch (error) {
    console.error("Error in Test Case 1:", error);
  }
};
and
import { text, mysqlView, int, datetime } from "drizzle-orm/mysql-core";

export const jotform_wm_item_file = mysqlView("jotform_wm_item_file", {
    submission_id: int("submission_id"),
    alecvid: text("alecvid"),
    created_on: datetime("created_on"),
});

export const db = drizzle(poolConnection, { schema: { jotform_wm_item_file }, mode: 'default' });
is my code.

I'm getting a parse error but im not sure why.
Was this page helpful?