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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysqliteog-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 28c3ecd021fcd22f881e5759a6b7e3a5691a41ec041161e0a44938df43e1abe1
MD5 bb9185b9fe02fce6e1e7f4a337c48a03
BLAKE2b-256 11c40f686edae955fdfa9c418909acad7b59683eaa2a32b9a47e8903454b6cad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysqliteog-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4b22dccd78f3078dcc73c84fbac7502bea895e82761a26d3cd4a84071ca6e793
MD5 77942755482b7a1eb5753a66125ce7b5
BLAKE2b-256 88f0405c35b7ea277ffe4234186c4280ed7f42339702f39978b030f6ce029542

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