libSQL for pyDAL
Basic driver/adapter for using libSQL/sqld (Turso) with pyDAL.
More info:
Examples:
Basic Usage with a SQLite compatible Database
from pydal import DAL
# import is required to set up libsql:// and sqld:// for pyDAL
import pydal_libsql
# Connecting to a libSQL/SQLite database
db = DAL("libsql://example.db")
# example pydal operations:
# Defining a 'person' table with some fields
db.define_table(
"person",
db.Field("name", "string"),
db.Field("age", "integer"),
db.Field("last_name", "string")
)
# Committing the changes to the database
db.commit()
# Inserting a record into the 'person' table
db.person.insert(name="Henk", age=33)
# Retrieving and printing the inserted record
print(db(db.person.name == "Henk").select().as_list())
Connecting to a SQLd Server
from pydal import DAL
# import is required to set up libsql:// and sqld:// for pyDAL:
import pydal_libsql
# Connect to a SQLd server running on localhost:8080
db = DAL("sqld://localhost:8080")
# ...
Using Turso's SQL Service
from dotenv import dotenv_values
from pydal import DAL
# import is required to set up libsql:// and sqld:// for pyDAL:
import pydal_libsql
# Load Turso credentials from .env file or replace with your values directly
env = dotenv_values()
uri = env.get("TURSO_DATABASE_URL") # Example: "libsql://your-database-name.turso.io"
token = env.get("TURSO_AUTH_TOKEN") # Example: "ey****"
# Set up the database connection with Turso's URI and authentication token
db = DAL(uri, driver_args={"auth_token": token})
# ...
Disclaimer
This project is an unofficial tool and is not affiliated, endorsed, or sponsored by the maintainers of pyDAL or Turso. All references to pyDAL and Turso are for compatibility and integration purposes only.
Metadata
Release files for pydal-libsql 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydal_libsql-0.2.0.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pydal_libsql-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.9 kB
Release files / pydal_libsql-0.2.0.tar.gz
| Download URL | pydal_libsql-0.2.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4db0d876bb14b51f6b016383a73744ce72a9343ba8aa7da893443ae56bee6ef
|
|
BLAKE2b-256 checksum How to use checksums |
b7bd4a80228ed47cfb3a83ec57221c7bafd33b675e1c7c55f4122bf7b537a7e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.2
|
Release files / pydal_libsql-0.2.0-py3-none-any.whl
| Download URL | pydal_libsql-0.2.0-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8f6cb7dc68ff187e082c89342c079d1bd74e9f24cd77afaec0cc472babd40477
|
|
BLAKE2b-256 checksum How to use checksums |
7be67f6d91b4bf1bc09f3f50522ccd286f13f27c7020fce69bbcdd0c81d2f607
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.2
|