IBM-DB2 Wrapper Class
Project description
- Wrapper Class around ibm_db (IBM-DB2)
In IBM-DB2 after every read, the data needs to be fetched and after evey write, the data needs to be committed. But this class eliminates these requirements and make it simple to read and write to the database.
- Files:
ibmdb2/__init__.py
- Usage Examples:
import ibmdb2
db = ibmdb2.db(conn_str) ##-connect to the database using the connection string for example conn_str = “DATABASE=BLUDB; HOSTNAME=dashdb-txn-sbox-yp-dal09-04.services.dal.bluemix.net; PORT=50000; PROTOCOL=TCPIP; UID=username; PWD=password;”
Note: In the SQL statements all columns should be enclosed with “ double quotes and text be enclosed with ‘ single quotes.
db.read(‘select “column1”,”column2” from mytable where “column1” like 'myword' ‘) ##-returns column1 & 2 from table where column = myword
db.read(‘select “column” from table”, flat=False) ##-returns the raw read data
db.read(f’select “item” from table where “item” = '{Variable}'’) ##-read with string substitution
db.read1(‘sql statement’) ##-returns the first read data similar to fetchone
db.write(‘sql statement’) ##-writes the data and commits to the database
- For other connection commands use the connection class
db.conn….
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
File details
Details for the file ibmdb2-0.3.tar.gz
.
File metadata
- Download URL: ibmdb2-0.3.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d168fd9cf53bd87476d5f79ef52db01be6f41da32a61d461baf10d79490c650a |
|
MD5 | 1d3f9950aa13ae1dcf11494731664357 |
|
BLAKE2b-256 | a8130fefb91e2d1f32ef6f50d8074c2e2ac9869a2eaecf62ecc138c8f9d52946 |