A simple and easy to use async wrapper for sqlite3.
Project description
asqlite
A simple and easy to use async wrapper for sqlite3
.
This is basically the same as sqlite3
except you use async with
and await
in front of most operations.
import asyncio
import asqlite
async def main():
async with asqlite.connect('example.db') as conn:
async with conn.cursor() as cursor:
# Create table
await cursor.execute('''CREATE TABLE stocks
(date text, trans text, symbol text, qty real, price real)''')
# Insert a row of data
await cursor.execute("INSERT INTO stocks VALUES ('2006-01-05','BUY','RHAT',100,35.14)")
# Save (commit) the changes
await conn.commit()
asyncio.run(main())
Install
To install this via PyPI, use the asqlite
package:
python3 -m pip install -U asqlite
Differences from sqlite3
This module differs from sqlite3
in a few ways:
- Connections are created with
journal_mode
set towal
. - Connections have foreign keys enabled by default.
- Implicit transactions are turned off
- The
row_factory
is set tosqlite3.Row
. - A
asqlite.Pool
is provided for connection pooling
License
MIT
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
asqlite-2.0.0.tar.gz
(9.1 kB
view details)
Built Distribution
File details
Details for the file asqlite-2.0.0.tar.gz
.
File metadata
- Download URL: asqlite-2.0.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97645200037f822c170e7dafa8b8422f85983a36e03060e47dcd932c0e1714a3 |
|
MD5 | 746562066bd465a1ab9c8b69555a2191 |
|
BLAKE2b-256 | c3c68349e97598590d1da0675b7ffbbb1c6293af5e9421d0c8683552e1ccab1b |
File details
Details for the file asqlite-2.0.0-py3-none-any.whl
.
File metadata
- Download URL: asqlite-2.0.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 271b4206dbab14da93ff191fb03f3166d11d8feec90467653762636810f040b5 |
|
MD5 | 61816ad06a4b732d6fa615f870e16219 |
|
BLAKE2b-256 | 1b29bc22327700c07d08894dfcbfb5a82349f533a0190171b3fd2d8b7dc7b8c8 |