This is a DRDA protocol (https://en.wikipedia.org/wiki/DRDA) database driver.
Currently, we support only DB2.
Pure python
Compliant with PEP-249 (https://www.python.org/dev/peps/pep-0249/)
Requirements
Python 3.8+
Installation
$ pip install pydrda
pyDes is required and is installed automatically as a dependency.
Supported Databases
Db2
https://www.ibm.com/analytics/db2
Example
No SSL
import drda
conn = drda.connect(host='serverhost', database='dbname', user='user', password='password', port=xxxxx, timeout=30)
cur = conn.cursor()
cur.execute('select * from foo where name=?', ['alice'])
for r in cur.fetchall():
print(r[0], r[1])
With SSL connection
import drda
conn = drda.connect(host='serverhost', database='dbname', use_ssl=True, user='user', password='password', port=xxxxx)
cur = conn.cursor()
cur.execute('select * from foo where name=?', ['alice'])
for r in cur.fetchall():
print(r[0], r[1])
With SSL and client certificate
import drda conn = drda.connect(host='serverhost', database='dbname', use_ssl=True, ssl_client_cert_path='/some/what/path/cert.crt', user='user', password='password', port=xxxxx)
AsyncIO
import asyncio
import drda.aio
async def main():
conn = await drda.aio.connect(host='serverhost', database='dbname', user='user', password='password', port=xxxxx, timeout=30)
cur = conn.cursor()
await cur.execute('select * from foo where name=?', ['alice'])
for r in await cur.fetchall():
print(r[0], r[1])
await conn.close()
asyncio.run(main())
Unit Tests
I have tested the following steps.
Db2
Start Db2 server
$ docker run -itd --name db2 --privileged=true -p 50000:50000 -e LICENSE=accept -e DB2INST1_PASSWORD=password -e DBNAME=testdb --platform=linux/amd64 icr.io/db2_community/db2
Execute test
$ python test_db2.py $ python test_async_db2.py
Metadata
Release files for pydrda 0.6.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pydrda-0.6.2.tar.gz | 24.3 kB | Details |
Release files / pydrda-0.6.2.tar.gz
| Download URL | pydrda-0.6.2.tar.gz |
|---|---|
| Size | 24.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eabda58a645fa790b3b4d1f398e8fe6e710c0ce942100526f1da39aea3ea2146
|
|
BLAKE2b-256 checksum How to use checksums |
f0174e459cf94b2c939b434220da59ded6a317b29c6df960e193190b68d6eb4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|