Python DB-API driver for Wherobots DB
Project description
wherobots-python-dbapi-driver
Python DB-API implementation for Wherobots DB. This package implements a PEP-0249 compatible driver to programmatically connect to a Wherobots DB runtime and execute Spatial SQL queries.
Installation
If you use Poetry in your project, add the
dependency with poetry add
:
$ poetry add git+https://github.com/wherobots/wherobots-python-dbapi-driver
Otherwise, just pip install
it:
$ pip install git+https://github.com/wherobots/wherobots-python-dbapi-driver
Usage
from wherobots.db import connect
from wherobots.db.region import Region
from wherobots.db.runtime import Runtime
with connect(
api_key='...',
runtime=Runtime.SEDONA,
region=Region.AWS_US_WEST_2) as conn:
curr = conn.cursor()
curr.execute("SHOW SCHEMAS IN wherobots_open_data")
results = curr.fetchall()
print(results)
The Cursor
also supports the context manager protocol, so you can use
it within a with
statement when needed:
with connect(...) as conn:
with conn.cursor() as curr:
curr.execute(...)
results = curr.fetchall()
It also implements the close()
method, as suggested by the PEP-2049
specification, to support situations where the cursor is wrapped in a
contextmanager.closing()
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for wherobots_python_dbapi-0.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86b6ddf96f57dfa351ba18489c9540b8a19d538eca50a41e1721dabcc3ff2dbe |
|
MD5 | 474522d7635dc5c771d493ca8b7d2705 |
|
BLAKE2b-256 | b2160fa16bb2e33ed0a28b2180f859ebc2e603d245def048725daf0fcf56e94b |
Close
Hashes for wherobots_python_dbapi-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9979efc40d481bc80b14c04f0b0760e2d223cc432b4e016151642d812fe9f7e |
|
MD5 | 07dfc42f0327a6bad2b5d06bbf4e5d51 |
|
BLAKE2b-256 | ce896b00a06d74c150baeac560b68ccea78fc26ae46e20646002b20ce90bebe9 |