Open penberg opened 11 months ago
@penberg any follow ups to this?
I am doing the following and it is not working:
Spin up a simple libsql-server and inject sample data into it
curl -d '{"statements": ["CREATE TABLE IF NOT EXISTS users (username)", "INSERT INTO users VALUES (\"alice\")"]}' 127.0.0.1:8082
Wrote a dead simple JS script to pull data from the table I created in step 1
// script called libsql_testing.js
const Database = require('libsql');
const url = process.env.LIBSQL_URL;
// const authToken = process.env.LIBSQL_AUTH_TOKEN;
// const opts = {
// authToken: authToken,
// };
const opts = {};
const db = new Database(url, opts);
const row = db.prepare("SELECT * FROM users").get();
console.log(row);
I am greeted with the following error when running node libsql_testing.js
$ node libsql_testing.js
/app/node_modules/libsql/index.js:104
throw new SqliteError(err.message, err.code, err.rawCode);
^
SqliteError: no such table: users
at Database.prepare (/app/node_modules/libsql/index.js:104:13)
at Object.<anonymous> (/app/libsql_testing.js:13:16)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:82:12)
at node:internal/main/run_main_module:23:47 {
code: 'SQLITE_ERROR',
rawCode: 1
}
Node.js v19.3.0
I am not sure how to proceed as my setup could not be any simpler and this library is not working with the libsql
project which it was designed upon
Looks like missing
execute_batch()
in the libSQL remote protocol implementation: