-
Notifications
You must be signed in to change notification settings - Fork 25
Closed
Labels
Description
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