# db_query
Python3 module for comfortable using of database (tested for sqlite3)
Usage:
import db_query
table = db_query.Table(sqlite3.connect('datebase.db'), 'tablename')
table.where(column1=value1, column2=value2) # -> list of rows matching given equalities
table.where(column1=(value11, value12), column2=value2) # -> executes 'SELECT * FROM tablename WHERE (column1 = value11 OR column1 = value12) AND column2 = value2' and returns result
table.where_raw('column1 LIKE "val%1" AND column2 = "kek"') # "raw" sql query (beware of vulnerabilities)
table(...) # -> table.where(...)
table.insert(value1, value2, ...) # insert new row into table
table.insert(column1=value1) # this also works - can be used if columns have default values
table.where(...).select(column1, column2) # executes 'SELECT column1, column2 FROM tablename WHERE ...' (and returnes result)
table.where(...).select() # -> table.where(...)
table.where(...).column1 # -> [_[0] for _ in table.where(...).select('column1')]
table.where(...)['column1'] # same
table.where(...).update(column1=value1, column2=value2) # update table
table.where(...).column1 = new_value # -> table.where(...).update(column1=new_value)
table.where(...).delete() # delete matching rows
table.delete(*args, **kwargs) # same
Python3 module for comfortable using of database (tested for sqlite3)
Usage:
import db_query
table = db_query.Table(sqlite3.connect('datebase.db'), 'tablename')
table.where(column1=value1, column2=value2) # -> list of rows matching given equalities
table.where(column1=(value11, value12), column2=value2) # -> executes 'SELECT * FROM tablename WHERE (column1 = value11 OR column1 = value12) AND column2 = value2' and returns result
table.where_raw('column1 LIKE "val%1" AND column2 = "kek"') # "raw" sql query (beware of vulnerabilities)
table(...) # -> table.where(...)
table.insert(value1, value2, ...) # insert new row into table
table.insert(column1=value1) # this also works - can be used if columns have default values
table.where(...).select(column1, column2) # executes 'SELECT column1, column2 FROM tablename WHERE ...' (and returnes result)
table.where(...).select() # -> table.where(...)
table.where(...).column1 # -> [_[0] for _ in table.where(...).select('column1')]
table.where(...)['column1'] # same
table.where(...).update(column1=value1, column2=value2) # update table
table.where(...).column1 = new_value # -> table.where(...).update(column1=new_value)
table.where(...).delete() # delete matching rows
table.delete(*args, **kwargs) # same
Metadata
Release files for db-query 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| db_query-1.3.0.tar.gz | 3.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| db_query-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.4 kB
Release files / db_query-1.3.0.tar.gz
| Download URL | db_query-1.3.0.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c908b0454367c6c5d546deab4d52f25a2cde8afeb9348b9ff6a8af7b13fdfb65
|
|
BLAKE2b-256 checksum How to use checksums |
67ff353bb0742134b63ec2ae9bf176a49312670fde846b71dd6676a951e844f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|
Release files / db_query-1.3.0-py3-none-any.whl
| Download URL | db_query-1.3.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e0f2ddd76a8f96cce84d93594ba4a798e1835071a5689a0abe5c9451c805b7e
|
|
BLAKE2b-256 checksum How to use checksums |
145b56deda95dacdfc2f08760bb45e343f6626532b40cce50f632a0ec9a20f5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7
|