drizzle-orm
drizzle-orm copied to clipboard
[BUG]:transactions options resulting in syntax error of mysql.
What version of drizzle-orm
are you using?
0.30.6
What version of drizzle-kit
are you using?
0.20.14
Describe the Bug
I am migrating from prisma to drizzle. After adding transaction options i am getting syntax error:
await $.drizzleClients.queryClient.transaction(
async tx => {
// some stuff.
}
// {
// isolationLevel: 'read committed',
// withConsistentSnapshot: true,
// accessMode: 'read write',
// }
)
Expected behavior
After removing this options it's working fine. Here is the error log:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`set transaction `' at line 1, stack: Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`set transaction `' at line 1
Environment & setup
MacOS M1, 13.0.1
Can confirm this, using [email protected]
I needed to read uncommited in my case, added explicit commit to my transaction for now:
await db.execute(sql`commit`);
Here is the only log with logger :true
:
Query: ?? -- params: ["set transaction ", "isolation level read uncommitted"]
I believe I'm also experiencing this on [email protected]
I think this PR is related https://github.com/drizzle-team/drizzle-orm/pull/2089
I applied https://github.com/drizzle-team/drizzle-orm/pull/2089 as a local patch and can confirm that it fixes this issue for me.
@EmericW, just updated to latest!
I am getting same error in access mode.
@sailingwithsandeep I think this should be fixed in 0.32.2, but I can't confirmed that.