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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysqliteog-0.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0639f295098dceb015987492ed0f2d5f8534f3cb07e82a258850eef64b42a925
MD5 9bdcf67e4adf178947ed61dae8e17ba9
BLAKE2b-256 a74744f7318e360985113a1938c77b6ab2c11fb362f392607714bec6c53d15a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysqliteog-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 331881b48c4cb6b04cb1e8e6d98b66bb999d855401d7c84b5b4b603d893308e9
MD5 38c9ead6aac505b3f433b505cc96adea
BLAKE2b-256 256763cabf61e11ace6f113dcd9dbaf2b4ea94392241afbac61614dbd5d11da6

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