Skip to main content

LibSQL.org for SQLAlchemy

Project description

sqlalchemy-libsql

A LibSQL dialect for SQLAlchemy.

This dialect requires SQLAlchemy 2.0 or later.

Pre-requisites

Co-requisites

This dialect requires SQLAlchemy and libsql_client. They are specified as requirements so pip will install them if they are not already in place. To install, just:

pip install sqlalchemy-libsql

Getting Started

Create an URL that points to your libsql database. Then, in your Python app, you can connect to the database via:

from sqlalchemy import create_engine
engine = create_engine("sqlite+libsql://your-db.your-server.com?authToken=JWT_HERE&secure=true")

Note that secure=true query/search parameter will force the usage of secure WebSockets (wss://) to connect to the remote server.

Development

This project uses poetry, can be tested with pytest and should be checked with pre-commit. A pure-python test server is used as a submodule:

git clone https://github.com/libsql/sqlalchemy-libsql.git
cd sqlalchemy-libsql
git submodule init && git submodule update  # hrana-test-server

pre-commit install         # install git-hooks
poetry install --with dev  # pytest

pre-commit run -a          # check all files in the project, runs pytest

poetry run pytest
poetry run pytest --log-debug=libsql_client  # debug libsql_client usage
# run against WSS server:
poetry run pytest --dburi "sqlite+libsql://server.com?secure=true&authToken=JWT_HERE"

The SQLAlchemy Project

SQLAlchemy-libsql is part of the SQLAlchemy Project and adheres to the same standards and conventions as the core project.

Development / Bug reporting / Pull requests

Please refer to the SQLAlchemy Community Guide for guidelines on coding and participating in this project.

Code of Conduct

Above all, SQLAlchemy places great emphasis on polite, thoughtful, and constructive communication between users and developers. Please see our current Code of Conduct at Code of Conduct.

Credits

This project structure is based on https://github.com/gordthompson/sqlalchemy-access, a project cited at README.dialects.rst.

License

SQLAlchemy-libsql is distributed under the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlalchemy_libsql-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

sqlalchemy_libsql-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_libsql-0.1.0.tar.gz.

File metadata

  • Download URL: sqlalchemy_libsql-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/22.5.0

File hashes

Hashes for sqlalchemy_libsql-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5b44506d0e59f5021b6b63b7b97496889cb3692cdd443c0fe5e2b63abcab589f
MD5 76f613fa7a5f6086eb991f30dd5ebb56
BLAKE2b-256 9e4bb698ff846ff0ef5bbdcdd8b76c74ff69c9e248395ae5168d1d87264aeb4d

See more details on using hashes here.

File details

Details for the file sqlalchemy_libsql-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_libsql-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a4d5cf4089cf3a229d5b1b20e9b8ca7ac8e2c0784a11c5ead3c66c5c9b18ae19
MD5 83492d31d2dd1f9b9db08983f2c7b2c1
BLAKE2b-256 08954476bb94c2da3dbc164f7174ccc7860aea28f1cb2302c5b895755f28ae36

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page