esqlite means 'easy sqlite', is a sqlite3 wrapper.
Project description
esqlite
esqlite means 'easy sqlite', is a sqlite3 wrapper. method 'execute' for execute any SQL and return result set. method 'batch_save' for batch insert dict list data. Table will be created if the table not exists.
install
pip install esqlite
example
import esqlite
db = esqlite.DB('test.db')
data = [{'id': 1, 'name': 'Bob'}, {'id': 2, 'name': 'Lena'}]
# batch save, default init table with dict keys
db.batch_save('user', data, cleanup=True)
# insert
db.execute('insert into user(id, name) values (?,?)', [3, 'C++'])
print(db.execute('select * from user'))
# update
db.execute('update user set name=? where id=?', ['Python', 3])
print(db.execute('select * from user'))
# delete
db.execute('delete from user where id=?', [3])
# find
print(db.execute('select * from user order by id desc'))
file test.db
will be created and console will print:
[{'id': 1, 'name': 'Bob'}, {'id': 2, 'name': 'Lena'}, {'id': 3, 'name': 'C++'}]
[{'id': 1, 'name': 'Bob'}, {'id': 2, 'name': 'Lena'}, {'id': 3, 'name': 'Python'}]
[{'id': 2, 'name': 'Lena'}, {'id': 1, 'name': 'Bob'}]
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
esqlite-0.0.1.tar.gz
(2.4 kB
view details)
File details
Details for the file esqlite-0.0.1.tar.gz
.
File metadata
- Download URL: esqlite-0.0.1.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e5fc70412793ba6c6ba871960f0c40e949c35e54bdd396c56b2af8486ef29ac |
|
MD5 | 5d8d67c0fd918db5968fe9f855c60330 |
|
BLAKE2b-256 | 4cb564f800397b4b6182864c8f114e1274179d0e7e8252c81f14de15bf5a7057 |