Skip to main content

A simple and easy to use async wrapper for sqlite3.

Project description

asqlite

THIS IS JUST A FORK OF DANNY'S ASQLITE, AND I DO NOT OWN ANY PART OF THIS CODE

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())

Differences from sqlite3

This module differs from sqlite3 in a few ways:

  1. Connections are created with journal_mode set to wal.
  2. Connections have foreign keys enabled by default.
  3. Implicit transactions are turned off
  4. The row_factory is set to sqlite3.Row.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

asqlite-0.0.1-py3.8.egg (13.7 kB view hashes)

Uploaded Source

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