Using magic SQL operator with 2 SQL dbs

Hi folks, In my project I need to connect to both separate mysql and postgres databases. I am able to successfully do so and create database objects but trying to execute raw SQL is not working currently using the magic SQL wrapper syntax. Typescript is confused because it does not know how to assign the types for sql as it tries to assign them from mysql and pg types
import { langlfowDb } from "..";
import { sql } from "drizzle-orm";


export const queryAgents = async () => {
const result = await langlfowDb.execute(
sql`select * from flow where locked = true;`,
);
console.log(result);
};
import { langlfowDb } from "..";
import { sql } from "drizzle-orm";


export const queryAgents = async () => {
const result = await langlfowDb.execute(
sql`select * from flow where locked = true;`,
);
console.log(result);
};
I get this error message:
Argument of type 'SQL<unknown>' is not assignable to parameter of type 'SQLWrapper'.
The types returned by 'getSQL()' are incompatible between these types.
Type 'import("/Users/revan/dev/archeAi/nextarche/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/drizzle-orm/sql/sql").SQL<unknown>' is not assignable to type 'import("/Users/revan/dev/archeAi/nextarche/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/drizzle-orm/sql/sql").SQL<unknown>'.
Types have separate declarations of a private property 'shouldInlineParams'.ts(2345)
Argument of type 'SQL<unknown>' is not assignable to parameter of type 'SQLWrapper'.
The types returned by 'getSQL()' are incompatible between these types.
Type 'import("/Users/revan/dev/archeAi/nextarche/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected][email protected][email protected]/node_modules/drizzle-orm/sql/sql").SQL<unknown>' is not assignable to type 'import("/Users/revan/dev/archeAi/nextarche/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/drizzle-orm/sql/sql").SQL<unknown>'.
Types have separate declarations of a private property 'shouldInlineParams'.ts(2345)
How can resolve this issue?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?