Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open .db file with read_write access mode #1951

Open
justsparsh opened this issue Feb 5, 2025 · 0 comments
Open

Cannot open .db file with read_write access mode #1951

justsparsh opened this issue Feb 5, 2025 · 0 comments

Comments

@justsparsh
Copy link

justsparsh commented Feb 5, 2025

What happens?

I am encountering the following error when trying to open a .db file with READ_WRITE access mode.

Error: Opening file test.db failed: cannot open file with both read and write flags set

Is this expected behaviour? I couldn't find any documentation talking about the limitations of the access mode.

To Reproduce

import * as duckdb from '@duckdb/duckdb-wasm';

const JSDELIVR_BUNDLES = duckdb.getJsDelivrBundles();

const bundle = await duckdb.selectBundle(JSDELIVR_BUNDLES);

const worker_url = URL.createObjectURL(
new Blob([`importScripts("${bundle.mainWorker!}");`], {type: 'text/javascript'})
);

const worker = new Worker(worker_url);
const logger = new duckdb.ConsoleLogger();
const db = new duckdb.AsyncDuckDB(logger, worker);
await db.instantiate(bundle.mainModule, bundle.pthreadWorker);
await db.registerFileURL('test.db', 'http://localhost:3000/data/test.db', duckdb.DuckDBDataProtocol.HTTP, true )
await db.open({path: 'test.db', accessMode: duckdb.DuckDBAccessMode.READ_WRITE })
URL.revokeObjectURL(worker_url);

const connection = await db.connect();

await connection.query(`
    INSTALL spatial;
    INSTALL json;
    LOAD spatial;
    LOAD json;
`);

connection.close();

Browser/Environment:

Chrome 132

Device:

MacOS (M2)

DuckDB-Wasm Version:

1.29.0

DuckDB-Wasm Deployment:

Local development

Full Name:

Sparsh Kumar

Affiliation:

Nika

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant