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:
Packages:
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, ('webmaster@python.org', '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, ('webmaster@python.org',))
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.
Release files for PyCovenantSQL 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| PyCovenantSQL-0.1.5.tar.gz | 14.3 kB | Details |
Release files / PyCovenantSQL-0.1.5.tar.gz
| Download URL | PyCovenantSQL-0.1.5.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27c0b1edeb2194de8f36fc8bc6416934df94cdf023f0856d9306a7841ef4d043
|
|
BLAKE2b-256 checksum How to use checksums |
9766a6e578803e3351052ee36f4939051291337cab24a090d1caa7bf08028c47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.3
|