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.0b7.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pysqlx_engine-0.3.0b7.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.0b7.tar.gz
Algorithm Hash digest
SHA256 0ba2c407562351acdd66a81cdcc2287943ed96417a350785c7216c99a8a3fdec
MD5 36fc96e4ddfcbfb94c57e694881093c2
BLAKE2b-256 9bd82a5667cb0ad09b299e59cdabd3b5d80303601f8220de85d7c348a049c797

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pysqlx_engine-0.3.0b7-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.0b7-py3-none-any.whl
Algorithm Hash digest
SHA256 84079eb204240354a641f02c4fc652e71c131b93733197b992123e010a802a72
MD5 e06cda5ed5091d4d6a498a7c218eb1df
BLAKE2b-256 c8c4b8f51592edbdf45baad4b5392227d96b7d27229afa5a24c4a5d6d7ff470c

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