joshpachner
joshpachner
DTDrizzle Team
Created by joshpachner on 5/4/2024 in #help
Query View syntax error at or near "$1"
I've declared my view like such
export const myView = pgView("my_view", {
{my fields}
}).existing();
export const myView = pgView("my_view", {
{my fields}
}).existing();
And then when i query my view
const results = await db.select().from(myView)
const results = await db.select().from(myView)
I get the syntax error When printing out the sql of it via
const results = await db.select().from(myView).toSQL()
const results = await db.select().from(myView).toSQL()
Gives me these results
{
sql: "select from $1",
params: [
r {
[Symbol("drizzle:ViewBaseConfig")]: {
name: "my_view",
originalName: "my_view",
schema: undefined,
selectedFields: {
my fields
},
query: undefined,
isExisting: true,
isAlias: false
},
[Symbol("drizzle:PgViewConfig")]: undefined
}
]
}
{
sql: "select from $1",
params: [
r {
[Symbol("drizzle:ViewBaseConfig")]: {
name: "my_view",
originalName: "my_view",
schema: undefined,
selectedFields: {
my fields
},
query: undefined,
isExisting: true,
isAlias: false
},
[Symbol("drizzle:PgViewConfig")]: undefined
}
]
}
What am i missing? Any direction would be greatly appreciated 🙏 Im on drizzle orm version 0.30.9
4 replies