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.5.tar.gz (9.9 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.5-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysqliteog-0.0.5.tar.gz
  • Upload date:
  • Size: 9.9 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.5.tar.gz
Algorithm Hash digest
SHA256 498680112b616fadf0f3b56e40a6dc33b40328470b385556309628eaf4916095
MD5 988f3a70123eed5d345d5b8e0c539b7b
BLAKE2b-256 12732922b6f055357fe93a25d91d689cee6abe6c245e6841d3cc958422e4a50e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysqliteog-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 10.8 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1622530be417f69b479fc5a96ef58194076fed5956d9b23037f1693e3c8ddf72
MD5 f2dfa90a4509d8e6ded7662e627bdcbc
BLAKE2b-256 09debbc4ba4161188cedd38f3a6d5c154f4e0e75e890c9e76e77c4524d4e6912

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