sveltespot / libsql-python

libSQL API for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PyLibSQL

This is a fork of the original libsql-experimental-python project.

Caution

This is a work in progress and is not yet ready for production use.

Installation

Note

This package is not yet available on PyPI and must be installed from source. Easiest way to install is to clone the repository, source the virtual environment and run maturin develop.

git clone https://github.com/sveltespot/pylibsql.git
cd pylibsql
python3 -m venv ~/.venv
source ~/.venv/bin/activate
pip install maturin
maturin develop

Usage

import pylibsql

con = pylibsql.connect("hello.db", sync_url="http://localhost:8080", auth_token="")

con.sync()

cur = con.cursor()

cur.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER, email TEXT);")
cur.execute("INSERT INTO users VALUES (1, 'penberg@iki.fi')")

print(cur.execute("SELECT * FROM users").fetchone())

Development

Dependencies

  • Python 3.7+ with pip and venv (Install python-dev package for your distribution)
  • Rust toolchain
  • maturin (install with pip install maturin)

Building

maturin develop

About

libSQL API for Python


Languages

Language:Rust 59.1%Language:Python 37.1%Language:Dockerfile 2.6%Language:Nix 1.3%