- Notifications
You must be signed in to change notification settings - Fork6
Python driver for CovenantSQL
License
CovenantSQL/cql-python-driver
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Table of Contents
This package contains a pure-Python CovenantSQL client library, based onPEP 249.
NOTE: PyCovenantSQL only support high level APIs defined inPEP 249.
- Python -- one of the following:
- Packages:
- CovenantSQL Adapter Server:
- CovenantSQL >= 0.0.3
Package is uploaded onPyPI.
You can install it with pip:
$ python3 -m pip install PyCovenantSQL
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 atGithub.
The following examples make use of a simple table
CREATETABLE `users` (`id`INTEGERPRIMARY KEY AUTOINCREMENT,`email`varchar(255)NOT NULL,`password`varchar(255)NOT NULL);
importpycovenantsql# Connect to the database with dsn# host and port are your local CovenantSQL Adapter serverconnection=pycovenantsql.connect(dsn='covenantsql://your_database_id',host='localhost',port=11108, )try:withconnection.cursor()ascursor:# Create a new recordsql="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()withconnection.cursor()ascursor:# Read a single recordsql="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}
- 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
PyCovenantSQL is released under the Apache 2.0 License. See LICENSE for more information.
About
Python driver for CovenantSQL
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.