AlcaponeYou
AlcaponeYou
DTDrizzle Team
Created by AlcaponeYou on 4/17/2023 in #help
Raw sql`` quoting issue
Hi, I doing a work around until Drizzle supports generated columns. I have a manual script that adds the generated column + its index. I'm dynamically building the sql query since there's no typings yet.
const column = 'col-name'
sql`${column} < ${'10'}`
const column = 'col-name'
sql`${column} < ${'10'}`
The syntax above returns no data or sometimes all the data b/c it generates: 'col-name' < '10', which doesn't match b/c of the quote around the column name. If I hardcoded the query to:
sql`col-name < '10'`
sql`col-name < '10'`
Then it returns the correct results. Am I using sql incorrectly? Thanks! NOTE: I'm doing ${'10'} to test the ${} syntax which seems to be working fine. It's only an issue w/ the column.
28 replies