Skip to content

Commit fails in embedded replica mode #87

@penberg

Description

@penberg

The following program:

import os

import libsql_experimental as libsql

print(F"syncing with {os.getenv('LIBSQL_URL')}")
conn = libsql.connect("hello.db", sync_url=os.getenv("LIBSQL_URL"),
                      auth_token=os.getenv("LIBSQL_AUTH_TOKEN"))
conn.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER)")
conn.execute("INSERT INTO users(id) VALUES (1)")
conn.commit()

conn.sync()

print(conn.execute("select * from users").fetchall())

fails as follows:

(.env) penberg@vonneumann testing % python3 test.py
syncing with libsql://python-penberg.aws-eu-west-1.turso.io
Traceback (most recent call last):
  File "/Users/penberg/src/tursodatabase/libsql-experimental-python/testing/test.py", line 10, in <module>
    conn.commit()
    ~~~~~~~~~~~^^
ValueError: connection has reached an invalid state, started with Init

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions