tursodatabase / tursodatabase/libsql-js

Empty result when query with `kysely` + `libsql` at version 0.6.0-pre.9

Open
#195 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
335
Forks
48
Avg merge
3d 2h
Merged PRs (30d)
3

Description

I have a setup of kysely + better-sqlite3. But it wasn't working with Deno, so I swtich to this library. It worked at first, until...

I needed to patch it:

diff --git a/node_modules/libsql/wrapper.js b/node_modules/libsql/wrapper.js
index 732b19f..a0da2b1 100644
--- a/node_modules/libsql/wrapper.js
+++ b/node_modules/libsql/wrapper.js
@@ -255,6 +255,7 @@ class Statement {
   }
 
   get reader() {
+    return null
     throw new Error("not implemented");
   }

I did some batch inserts and it worked just fine but when I query, it just returns empty:

const rows = await db.selectFrom("lookup")
    .selectAll()
    .executeTakeFirstOrThrow()

I checked and made extra sure the table had data.

I changed the version from 0.6.0-pre.9 to 0.5.13 and it worked without the patch above.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Kysely query with libsql 0.6.0-pre.9 after batch inserts, then compare it with 0.5.13. Start by inspecting wrapper.js around Statement.reader and run the shown executeTakeFirstOrThrow query. Done means the query returns the inserted row without patching node_modules.

Written by the indexing model from the issue text.

Assessment

Tech stack
deno, javascript, sqlite
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.