drizzle-team / drizzle-team/drizzle-orm
[BUG]: RQBv2 not working with op-sqlite
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] I have verified that the bug I'm about to report hasn't been filed before.
### What version of `drizzle-orm` are you using?
1.0.0-rc.3
### What version of `drizzle-kit` are you using?
1.0.0-rc.3
### Other packages
_No response_
### Describe the Bug
It seems like the op-sqlite integration is completely broken with RQBv2.
Internally, in [session.js](https://github.com/drizzle-team/drizzle-orm/blob/v1.0.0-rc.3/drizzle-orm/src/op-sqlite/session.ts), `client.execute` is called _synchronously_, but it's an async method. It's called by both the [allRqbV2](https://github.com/drizzle-team/drizzle-orm/blob/771c61eb2317337b86827d8c2220b11731958268/drizzle-orm/src/op-sqlite/session.ts#L223) and [getRqbV2](https://github.com/drizzle-team/drizzle-orm/blob/771c61eb2317337b86827d8c2220b11731958268/drizzle-orm/src/op-sqlite/session.ts#L269) methods. These should both be using the await keyword.
Additionally, both are expecting the `rows` property to have an `_array` property, which doesn't seem to exist:
```
const rows = client.execute(query.sql, params).rows?._array || [];
```
I believe the code should probably be something like (and this works for me when I patch the code):
```
const result = await client.execute(query.sql, params);
const rows = result.rows || [];
```
Contributor guide
Research direction
Start in drizzle-orm/src/op-sqlite/session.ts, focusing on the allRqbV2 and getRqbV2 methods. Check how client.execute is used there and verify the returned rows shape for op-sqlite. Done means both RQBv2 paths handle the asynchronous result and use its rows correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite, typescript
- Domain
- database
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100