Skip to main content

a python DBAPI 2.0 interface for sqlite-og

Project description

pysqliteog

A client library for sqlite-og, based on the Python Database API Specification v2.0 specification.

Installation

pip install pysqliteog

This will install pysqliteog along with it's dependencies grpcio & protobuf

Usage

Basic Usage

import pysqliteog

# connect to the database
db = pysqliteog.connect('<host>', '<port>', '<db-name>')
with db.cursor() as cur:
    cur.execute('select 1')
    print(f"{cur.fetchone()}")
db.close()

Using Callbacks

The client allows you to define custom function that can be used directly in your queries.

import pysqliteog


# define a custom callback function
def say_hello(x):
    return f'hello {x}'


# connect to the database
db = pysqliteog.connect('<host>', '<port>', '<db-name>')
# all custom function must be registered before creating the first cursor
db.create_function('say_hello', 1, say_hello)

with db.cursor() as cur:
    cur.execute('select say_hello(?)', params=['world'])
    # should print "hello world"
    print(f"{cur.fetchone()}")

db.close()

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

pysqliteog-0.0.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysqliteog-0.0.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file pysqliteog-0.0.1.tar.gz.

File metadata

  • Download URL: pysqliteog-0.0.1.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pysqliteog-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9a5ba65be93e5060d43aee737f1234041137db78012fff343bb2ed09bfa3f17e
MD5 533fc8854dcb78be0503a4cd9bbd7655
BLAKE2b-256 010312d0885aec3385a3d52db0ab6e0eaf34035c726eb6c6b3158744846c8a04

See more details on using hashes here.

File details

Details for the file pysqliteog-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pysqliteog-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pysqliteog-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45f62c934e0a5896b3d82a202c9841354733c57e783b7467439fa516658858ff
MD5 8d6080752144594ea78f551b34b86aaf
BLAKE2b-256 df4d13bf614d076f6d1b63f577d760ce61095c570ed4cdb91907ca742c4d7181

See more details on using hashes here.

Supported by

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