Skip to main content

Makes working with existing sql databases super easy

Project description

HPDB

Current version: 4.0.2

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.2.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

hpdb-4.0.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file hpdb-4.0.2.tar.gz.

File metadata

  • Download URL: hpdb-4.0.2.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for hpdb-4.0.2.tar.gz
Algorithm Hash digest
SHA256 94abc3261cc96961b4f7f33bfed87668d9db1bb87f366a76f40b46ac9447fd8b
MD5 d0f3e92d8e0c2fcec4044ec3dd2675e9
BLAKE2b-256 6b16fe38d0f64343442d4f2c12dbe3f6f0bd96bef349f3663881355f1a6eb7c7

See more details on using hashes here.

File details

Details for the file hpdb-4.0.2-py3-none-any.whl.

File metadata

  • Download URL: hpdb-4.0.2-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.8

File hashes

Hashes for hpdb-4.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4b81d13b376e46f67e5427c66575cec048650be8e973d417f8045bb9e3a724b8
MD5 a767cf5491cd032fb6b1cda2e5c6af94
BLAKE2b-256 87662914109ffb4383a98487a5fe43c50f5b39d326651ca3471155ff7cba7141

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page