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.3.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.3-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysqliteog-0.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 85d9c9da79da5b64016b410c84941dd7bffb76953fdcdcaa71d9cab865cdb646
MD5 2660adfee86628cb9491fdaa1745ac63
BLAKE2b-256 ffa085f0a5a9f17523721ccec4eee020ec914187d193854125418fcfa88d408f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysqliteog-0.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8020d2544f85e2084fb22237d6afc4d0501e4c56732ec17b72fbda269b4b934b
MD5 c33b7947e46336ec6a295f8441ff454f
BLAKE2b-256 c6bad7dfcc736ec8028b293dc4787ac9f7cd159b3353cc43c62b1002b9d3c077

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