pysqlx-core

pysqlx-core is an extremely fast Python library for communicating with various SQL databases.
This package provides the core functionality for PySQLX-Engine.
The package is currently a work in progress and subject to significant change.
pysqlx-core will be a separate package, required by pysqlx-engine.
This package is written entirely in Rust and compiled as a Python library using PyO3 and PyO3-Asyncio.
This core is not so friendly, but maybe you want to use it, feel free to suggest improvements.
Supported databases
Supported Python versions
Supported operating systems
Example of installation:
PIP
$ pip install pysqlx-core
Poetry
$ poetry add pysqlx-core
Example of usage:
import pysqlx_core
import asyncio
async def main(sql):
db = await pysqlx_core.new(uri="postgresql://postgres:postgrespw@localhost:49153")
stmt = pysqlx_core.PySQLxStatement(
provider="postgresql",
sql="""
CREATE TABLE IF NOT EXISTS test (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL
);
""")
await db.execute(stmt=stmt)
insert = pysqlx_core.PySQLxStatement(
provider="postgresql",
sql="INSERT INTO test (name) VALUES (:name);",
params={"name": "Carlos"}
)
await db.execute(stmt=insert)
print("SQL:", insert.sql())
print("PARAMS:", insert.params())
result = await db.query_typed(stmt=pysqlx_core.PySQLxStatement(
provider="postgresql",
sql="SELECT * FROM test;"
)
)
row = result.get_first()
rows = result.get_all()
types = result.get_types()
rows = await db.query_all(pysqlx_core.PySQLxStatement(provider="postgresql", sql="SELECT * FROM test;"))
asyncio.run(main())