Makes working with existing sql databases super easy
Project description
HPDB
Current version: 4.0.1
dbClass
installation
python -m pip install hpdb
usage
settings.ini
[database]
dbhost = myhost.mydomain.com
dbname = database_name
dbuser = database_user
dbpass = secret123
Initializing from ini file
from hpdb import dbClass
db = dbClass.from_inifile('settings.ini')
Initializing directly
db = dbClass( host, dbname, user, passwd )
SELECT
db.select('users',{'isactive':1} )
LOOKUP SPECIFIC VALUES
db.lookup('users',{'id':15}, ['name', 'active] )
INSERT
db.insert('users', {'name':'john', 'isactive':1})
id = db.last_insert_id()
UPDATE
db.update( 'users', {'name':'john'}, {'active':0})
DELETE
db.delete( 'users', {'name':'john'})
QUERY
db.execute( 'SELECT * FROM users' )
Don't forget to commit when you have an innodb table
db.commit()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hpdb-4.0.1.tar.gz
(5.0 kB
view details)
Built Distribution
hpdb-4.0.1-py3-none-any.whl
(5.7 kB
view details)
File details
Details for the file hpdb-4.0.1.tar.gz
.
File metadata
- Download URL: hpdb-4.0.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dda811f3b4ce1dbbb36605fde6293e9ed1e3359090c5c1f7399e0593ca06a14f |
|
MD5 | 0457b2132486c29772f2211294bd9c13 |
|
BLAKE2b-256 | e8eac4be7d96703334b4151303ec79d8a5b1a7a6a5aee1283c114c6561bd51dd |
File details
Details for the file hpdb-4.0.1-py3-none-any.whl
.
File metadata
- Download URL: hpdb-4.0.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e81e92a9d531a2e29d5ce528e497edae9c84837d1923731a5b3d9ce45a5c26d9 |
|
MD5 | 36d7b8b10b65dce76efbffe3dd5cf785 |
|
BLAKE2b-256 | e25ad542968aa8ea1847063f24d4552fc2396b28afd270f3f8c5eae138eb22f7 |