GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - CovenantSQL/cql-python-driver: Python driver for CovenantSQL

BranchesTags
Open more actions menu

Latest commit

 

History

53 Commits
53 Commits

Folders and files

NameName
Last commit message
Last commit date
pycovenantsql
pycovenantsql
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Pipfile
Pipfile
 
 
README.rst
README.rst
 
 
benchmark.py
benchmark.py
 
 
example.py
example.py
 
 
runtests.py
runtests.py
 
 
setup.py
setup.py
 
 

Repository files navigation

PyCovenantSQL

Table of Contents

  • Requirements
  • Installation
  • Documentation
  • Example
  • Resources
  • License

This package contains a pure-Python CovenantSQL client library, based on PEP 249.

NOTE: PyCovenantSQL only support high level APIs defined in PEP 249.

Requirements

  • Python -- one of the following:
    • CPython : 2.7 and >= 3.4
    • PyPy : Latest version
  • Packages:
    • Requests >= 2.19
    • Arrow >= 0.13
  • CovenantSQL Adapter Server:
    • CovenantSQL >= 0.0.3

Installation

Package is uploaded on PyPI.

You can install it with pip:

$ python3 -m pip install PyCovenantSQL

Documentation

Documentation is available online: http://developers.covenantsql.io/

Key file and dsn can get from: http://developers.covenantsql.io/docs/quickstart

For support, please fire a issue at Github.

Example

The following examples make use of a simple table

CREATE TABLE `users` (
    `id` INTEGER PRIMARY KEY AUTOINCREMENT,
    `email` varchar(255) NOT NULL,
    `password` varchar(255) NOT NULL
);
import pycovenantsql


# Connect to the database with dsn
# host and port are your local CovenantSQL Adapter server
connection = pycovenantsql.connect(
                             dsn='covenantsql://your_database_id',
                             host='localhost',
                             port=11108,
                             )

try:
    with connection.cursor() as cursor:
        # Create a new record
        sql = "INSERT INTO `users` (`email`, `password`) VALUES (%s, %s)"
        cursor.execute(sql, ('[email protected]', 'very-secret'))

    # connection is autocommit. No need to commit in any case.
    # connection.commit()

    with connection.cursor() as cursor:
        # Read a single record
        sql = "SELECT `id`, `password` FROM `users` WHERE `email`=%s"
        cursor.execute(sql, ('[email protected]',))
        result = cursor.fetchone()
        print(result)
finally:
    connection.close()

This example will print:

{'password': 'very-secret', 'id': 1}

Resources

  • DB-API 2.0: http://www.python.org/dev/peps/pep-0249
  • CovenantSQL Website: https://covenantsql.io/
  • CovenantSQL testnet quick start: https://testnet.covenantsql.io/quickstart
  • CovenantSQL source code: https://github.com/CovenantSQL/CovenantSQL

License

PyCovenantSQL is released under the Apache 2.0 License. See LICENSE for more information.

About

Python driver for CovenantSQL

Topics

covenantsqlcqlpythonpython3sql

Resources

Readme
Apache-2.0 license
Activity
Custom properties

Stars

6 stars

Watchers

1 watching

Forks

5 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.