Simple class that wraps around the sqlite3.conn().cursor().execute() method
from simplesqlitewrap import Database
class DbWrapper(Database):
def create_tables(self):
self._execute('CREATE TABLE IF NOT EXISTS Users (user_id INTEGER PRIMARY KEY, first_name NVARCHAR);')
def insert_users(self, users, **kwargs):
return self._execute('INSERT OR IGNORE INTO Users (user_id, first_name) VALUES (?, ?)', users, many=True, **kwargs)
def select_users(self, **kwargs):
# returns the list of all the records in 'Users'
return self._execute('SELECT * FROM Users', fetchall=True, **kwargs)
db = DbWrapper('database.sqlite')
print(db)
db.create_tables()
params = [(1, 'Bob'), (2, 'Charlie')]
rows_inserted = db.insert_users(params, rowcount=True)
print('Rows inserted:', rows_inserted)
users = db.select_users(as_namedtuple=True)
for user in users:
print('ID:', user.user_id, 'first name:', user.first_name)
Installation
pip install simplesqlitewrap
Disclaimer
If you stumbled upon this package, please remember that this is just a small utility I made for myself - breaking changes may be introduced without notice. Also, my first pypi package - will probably use it for tests and sheningans.
Metadata
Release files for simplesqlitewrap 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simplesqlitewrap-0.1.15.tar.gz | 3.9 kB | Without provenance | Details for simplesqlitewrap-0.1.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simplesqlitewrap-0.1.15-py3-none-any.whl | Python 3 | none | any | Details for simplesqlitewrap-0.1.15-py3-none-any.whl |
Total release size: 7.9 kB
Release files / simplesqlitewrap-0.1.15.tar.gz
| Download URL | simplesqlitewrap-0.1.15.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d077eeff4b8c6b089e2311d855ca968de38ae4b2f9c56cd06b71e43041344382
|
|
BLAKE2b-256 checksum How to use checksums |
7997b3c7ba7c7c40944b7c0be66d500a819a709c6d9e76969049790678e39332
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.4
|
Release files / simplesqlitewrap-0.1.15-py3-none-any.whl
| Download URL | simplesqlitewrap-0.1.15-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5933f004b454c6006b8bd2149b7a50feaa18204b2d460260f16f1ebb2754411a
|
|
BLAKE2b-256 checksum How to use checksums |
2845fd8a334cddf5b999c2d276a1ae550744b17435d7bbe809c453d4e09f9f4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.4
|
Security for simplesqlitewrap 0.1.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.