drizzle-team / drizzle-team/drizzle-orm
[BUG]: Select operation returning [] while using ORM but not while using SQL
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### What version of `drizzle-orm` are you using?
0.32.0
### What version of `drizzle-kit` are you using?
0.23.0
### Describe the Bug
I am using Drizzle ORM with Turso SQLite.
I am trying to select the items in a table but I am getting [] (empty array) while using the ORM style fetching. Code and screenshot below
```ts
export async function test() {
const result = await db.select().from(fooTable).all()
return result
}
```
Output:

But while using SQL I am getting the correct output, code and screenshot below:
```ts
export async function test() {
const result = (await db.run(sql`SELECT * from ${fooTable}`)).rows
return result
}
```
Output:

Surprisingly, Insert operation works with the ORM fetching, with this code
```ts
export async function test() {
const result = await db.insert(fooTable).values({ bar: "Deveesh Shetty" }).returning()
return result
}
```
### Expected behavior
This code should also return the rows in the table and not an empty array
```ts
export async function test() {
const result = await db.select().from(fooTable).all()
return result
}
```
### Environment & setup
Development environment
Using
Next.js `14.2.5`
Package Manager: pnpm `9.5.0`
Contributor guide
Assessment
This issue has not been assessed yet.