https://github.com/carlos-rian/pysqlx-engine
PySQLXEngine, a minimalist asynchronous SQL engine.
https://github.com/carlos-rian/pysqlx-engine
async asyncio asyncronous mssql mysql postgresql python python3 sql sqlite
Last synced: 2 months ago
JSON representation
PySQLXEngine, a minimalist asynchronous SQL engine.
- Host: GitHub
- URL: https://github.com/carlos-rian/pysqlx-engine
- Owner: carlos-rian
- Created: 2022-06-25T00:15:58.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-18T06:58:56.000Z (7 months ago)
- Last Synced: 2024-10-19T09:57:35.219Z (7 months ago)
- Topics: async, asyncio, asyncronous, mssql, mysql, postgresql, python, python3, sql, sqlite
- Language: Python
- Homepage: https://github.com/carlos-rian/pysqlx-engine
- Size: 15.4 MB
- Stars: 11
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# PySQLXEngine
PySQLXEngine, a fast and minimalist SQL engine---
**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
```console
$ uv add pysqlx-engine
```PIP
```console
$ pip install pysqlx-engine
```Poetry
```console
$ poetry add pysqlx-engine
```## Async Example
Create a `main.py` file and add the code examples below.
```python
from pysqlx_engine import PySQLXEngineasync 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.
```python
from pysqlx_engine import PySQLXEngineSyncdef 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
```console
$ python3 main.py
```
Output```python
[
BaseRow(id=1, name='Rian', age=28),
BaseRow(id=2, name='Carlos', age=29)
]
```