Closed blackary closed 1 week ago
Thank you for the question blackary.
In SQLite Cloud, you can establish a connection with the database in two ways: by setting user/pass/hostname
in the SqliteCloudAccount
or by using the connection string.
Since you want to use the connection string, you can initialize the SqliteCloudClient
like this:
from sqlitecloud.client import SqliteCloudClient
client = SqliteCloudClient(connection_str="sqlitecloud://user:pass@host.com:port/dbname?apikey=myapikey")
conn = client.open_connection()
result = client.exec_query("SELECT * FROM albums", conn)
print("First row album title: " + str(result.get_value(0, 1)))
client.disconnect(conn)
Let me know how it goes!
Excellent, thanks! I believe the old README suggested it was just the first argument, not a keyword argument, but that works well, as does the new method with the updated package.
python 3.10.12 sqlitecloud 0.77