Skip to main content

Async and Sync SQL Engine for Python, with support for PostgreSQL, MySQL, SQLite and Microsoft SQL Server.

Project description

PySQLXEngine

PySQLXEngine Logo

PySQLXEngine, a fast and minimalist SQL engine

CI Coverage Package version Supported Python versions Downloads


Documentation: https://carlos-rian.github.io/pysqlx-engine/

Source Code: https://github.com/carlos-rian/pysqlx-engine


PySQLXEngine supports the option of sending raw sql to your database.

The PySQLXEngine is a minimalist Async and Sync SQL engine. Currently this lib have supports async and sync programming.

The PySQLXEngine was created and thought to be minimalistic, but very efficient. The core is write in Rust, making communication between database and Python more efficient.

Database Support:

  • SQLite
  • PostgreSQL
  • MySQL
  • Microsoft SQL Server

OS Support:

  • Linux
  • MacOS
  • Windows

Installation

UV

$ uv add pysqlx-engine

PIP

$ pip install pysqlx-engine

Poetry

$ poetry add pysqlx-engine

Async Example

Create a main.py file and add the code examples below.

from pysqlx_engine import PySQLXEngine

async def main():
    db = PySQLXEngine(uri="sqlite:./db.db")
    await db.connect()

    await db.execute(sql="""
        CREATE TABLE IF NOT EXISTS users (
            id INTEGER PRIMARY KEY, 
            name TEXT, 
            age INT
        )
    """)
    await db.execute(sql="INSERT INTO users (name, age) VALUES ('Rian', '28')")
    await db.execute(sql="INSERT INTO users (name, age) VALUES ('Carlos', '29')")

    rows = await db.query(sql="SELECT * FROM users")

    print(rows)

import asyncio
asyncio.run(main())

Sync Example

Create a main.py file and add the code examples below.

from pysqlx_engine import PySQLXEngineSync

def main():
    db = PySQLXEngineSync(uri="sqlite:./db.db")
    db.connect()

    db.execute(sql="""
        CREATE TABLE IF NOT EXISTS users (
            id INTEGER PRIMARY KEY, 
            name TEXT, 
            age INT
        )
    """)
    db.execute(sql="INSERT INTO users (name, age) VALUES ('Rian', '28')")
    db.execute(sql="INSERT INTO users (name, age) VALUES ('Carlos', '29')")

    rows = db.query(sql="SELECT * FROM users")

    print(rows)

# running the code
main()

Running the code using the terminal

$ python3 main.py

Output

[
    BaseRow(id=1, name='Rian', age=28),  
    BaseRow(id=2, name='Carlos', age=29)
]

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

pysqlx_engine-0.3.0b6.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

pysqlx_engine-0.3.0b6-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file pysqlx_engine-0.3.0b6.tar.gz.

File metadata

  • Download URL: pysqlx_engine-0.3.0b6.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.2 Linux/6.5.0-1025-azure

File hashes

Hashes for pysqlx_engine-0.3.0b6.tar.gz
Algorithm Hash digest
SHA256 ae08220bec611d5c82b9254e0c059e8d1c30467c73313d296afaf10a557bc321
MD5 38c04f455cc540408646b105b0aea07e
BLAKE2b-256 2a24550b6fb2e869d79a8f120e693a34253741b6232f0f5055414e4c647dc486

See more details on using hashes here.

File details

Details for the file pysqlx_engine-0.3.0b6-py3-none-any.whl.

File metadata

  • Download URL: pysqlx_engine-0.3.0b6-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.2 Linux/6.5.0-1025-azure

File hashes

Hashes for pysqlx_engine-0.3.0b6-py3-none-any.whl
Algorithm Hash digest
SHA256 68abd7221ba9b365f0f0323129e443e861e6dcbff5127cfd5805709108b63bf8
MD5 9ebdf8c541ae334af135cce5e6838063
BLAKE2b-256 71acd6da3bab2b2c584429d6d60bdddd318a9d2d946a1a6eceb296f234bf06d3

See more details on using hashes here.

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