pysqlx-engine


Namepysqlx-engine JSON
Version 0.2.27 PyPI version JSON
download
home_pagehttps://carlos-rian.github.io/pysqlx-engine
SummaryAsync and Sync SQL Engine for Python, with support for MySQL, PostgreSQL, SQLite and Microsoft SQL Server.
upload_time2023-10-30 21:20:10
maintainer
docs_urlNone
authorCarlos Rian
requires_python>=3.7,<4.0
licenseMIT
keywords async database sql engine fastapi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PySQLXEngine

<p align="center">
  <a href="/"><img src="https://carlos-rian.github.io/pysqlx-engine/img/logo-text3.png" alt="PySQLXEngine Logo"></a>
</p>
<p align="center">
    <em>PySQLXEngine, a fast and minimalist SQL engine</em>
</p>

<p align="center">
<a href="https://github.com/carlos-rian/pysqlx-engine/actions/workflows/ci.yml" target="_blank">
    <img src="https://github.com/carlos-rian/pysqlx-engine/actions/workflows/ci.yml/badge.svg" alt="CI">
</a>
<a href="https://app.codecov.io/gh/carlos-rian/pysqlx-engine" target="_blank">
    <img src="https://img.shields.io/codecov/c/github/carlos-rian/pysqlx-engine?color=%2334D058" alt="Coverage">
</a>
<a href="https://pypi.org/project/pysqlx-engine" target="_blank">
    <img src="https://img.shields.io/pypi/v/pysqlx-engine?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://pypi.org/project/pysqlx-engine" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/pysqlx-engine.svg?color=%2334D058" alt="Supported Python versions">
</a>
<a href="https://pepy.tech/project/pysqlx-engine" target="_blank">
    <img src="https://static.pepy.tech/personalized-badge/pysqlx-engine?period=total&units=international_system&left_color=grey&right_color=brightgreen&left_text=Downloads" alt="Downloads">
</a>
</p>

---

**Documentation**: <a href="https://carlos-rian.github.io/pysqlx-engine/" target="_blank">https://carlos-rian.github.io/pysqlx-engine/</a>

**Source Code**: <a href="https://github.com/carlos-rian/pysqlx-engine" target="_blank">https://github.com/carlos-rian/pysqlx-engine</a>

---

PySQLXEngine supports the option of sending **Raw SQL** to your database.

The PySQLXEngine is a minimalist [SQL Engine](https://github.com/carlos-rian/pysqlx-engine).

The PySQLXEngine was created and thought to be minimalistic, but very efficient. The core is write in [**Rust**](https://www.rust-lang.org), making communication between Databases and [**Python**](https://python-poetry.org) more efficient.

All SQL executed using PySQLXEngine is atomic; only one instruction is executed at a time. Only the first one will be completed if you send an Insert and a select. This is one of the ways to handle SQL ingestion. As of version **0.2.0**, PySQLXEngine supports transactions, where you can control [`BEGIN`](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/begin-end-transact-sql?view=sql-server-ver16), [`COMMIT`](https://www.geeksforgeeks.org/difference-between-commit-and-rollback-in-sql), [ `ROLLBACK` ](https://www.geeksforgeeks.org/difference-between-commit-and-rollback-in-sql), [`ISOLATION LEVEL`](https://levelup.gitconnected.com/understanding-isolation-levels-in-a-database-transaction-af78aea3f44), etc. as you wish.


> **NOTE**:
    Minimalism is not the lack of something, but having exactly what you need.
    PySQLXEngine aims to expose an easy interface for you to communicate with the database in a simple, intuitive way and with good help through documentation, autocompletion, typing, and good practices.
---

Database Support:

* [`SQLite`](https://www.sqlite.org/index.html)
* [`PostgreSQL`](https://www.postgresql.org/)
* [`MySQL`](https://www.mysql.com/)
* [`Microsoft SQL Server`](https://www.microsoft.com/sql-server)

OS Support:

* [`Linux`](https://pt.wikipedia.org/wiki/Linux)
* [`MacOS`](https://pt.wikipedia.org/wiki/Macos)
* [`Windows`](https://pt.wikipedia.org/wiki/Microsoft_Windows)


## Installation


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 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.

```python
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


```console
$ python3 main.py
```
Output

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://carlos-rian.github.io/pysqlx-engine",
    "name": "pysqlx-engine",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "async,database,sql,engine,fastapi",
    "author": "Carlos Rian",
    "author_email": "crian.rian@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3d/bf/0e1ef2d333d1c0c49fc5630ffd28d4fd6377e0fd19f5a00f4a68b65318bf/pysqlx_engine-0.2.27.tar.gz",
    "platform": null,
    "description": "# PySQLXEngine\n\n<p align=\"center\">\n  <a href=\"/\"><img src=\"https://carlos-rian.github.io/pysqlx-engine/img/logo-text3.png\" alt=\"PySQLXEngine Logo\"></a>\n</p>\n<p align=\"center\">\n    <em>PySQLXEngine, a fast and minimalist SQL engine</em>\n</p>\n\n<p align=\"center\">\n<a href=\"https://github.com/carlos-rian/pysqlx-engine/actions/workflows/ci.yml\" target=\"_blank\">\n    <img src=\"https://github.com/carlos-rian/pysqlx-engine/actions/workflows/ci.yml/badge.svg\" alt=\"CI\">\n</a>\n<a href=\"https://app.codecov.io/gh/carlos-rian/pysqlx-engine\" target=\"_blank\">\n    <img src=\"https://img.shields.io/codecov/c/github/carlos-rian/pysqlx-engine?color=%2334D058\" alt=\"Coverage\">\n</a>\n<a href=\"https://pypi.org/project/pysqlx-engine\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/v/pysqlx-engine?color=%2334D058&label=pypi%20package\" alt=\"Package version\">\n</a>\n<a href=\"https://pypi.org/project/pysqlx-engine\" target=\"_blank\">\n    <img src=\"https://img.shields.io/pypi/pyversions/pysqlx-engine.svg?color=%2334D058\" alt=\"Supported Python versions\">\n</a>\n<a href=\"https://pepy.tech/project/pysqlx-engine\" target=\"_blank\">\n    <img src=\"https://static.pepy.tech/personalized-badge/pysqlx-engine?period=total&units=international_system&left_color=grey&right_color=brightgreen&left_text=Downloads\" alt=\"Downloads\">\n</a>\n</p>\n\n---\n\n**Documentation**: <a href=\"https://carlos-rian.github.io/pysqlx-engine/\" target=\"_blank\">https://carlos-rian.github.io/pysqlx-engine/</a>\n\n**Source Code**: <a href=\"https://github.com/carlos-rian/pysqlx-engine\" target=\"_blank\">https://github.com/carlos-rian/pysqlx-engine</a>\n\n---\n\nPySQLXEngine supports the option of sending **Raw SQL** to your database.\n\nThe PySQLXEngine is a minimalist [SQL Engine](https://github.com/carlos-rian/pysqlx-engine).\n\nThe PySQLXEngine was created and thought to be minimalistic, but very efficient. The core is write in [**Rust**](https://www.rust-lang.org), making communication between Databases and [**Python**](https://python-poetry.org) more efficient.\n\nAll SQL executed using PySQLXEngine is atomic; only one instruction is executed at a time. Only the first one will be completed if you send an Insert and a select. This is one of the ways to handle SQL ingestion. As of version **0.2.0**, PySQLXEngine supports transactions, where you can control [`BEGIN`](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/begin-end-transact-sql?view=sql-server-ver16), [`COMMIT`](https://www.geeksforgeeks.org/difference-between-commit-and-rollback-in-sql), [ `ROLLBACK` ](https://www.geeksforgeeks.org/difference-between-commit-and-rollback-in-sql), [`ISOLATION LEVEL`](https://levelup.gitconnected.com/understanding-isolation-levels-in-a-database-transaction-af78aea3f44), etc. as you wish.\n\n\n> **NOTE**:\n    Minimalism is not the lack of something, but having exactly what you need.\n    PySQLXEngine aims to expose an easy interface for you to communicate with the database in a simple, intuitive way and with good help through documentation, autocompletion, typing, and good practices.\n---\n\nDatabase Support:\n\n* [`SQLite`](https://www.sqlite.org/index.html)\n* [`PostgreSQL`](https://www.postgresql.org/)\n* [`MySQL`](https://www.mysql.com/)\n* [`Microsoft SQL Server`](https://www.microsoft.com/sql-server)\n\nOS Support:\n\n* [`Linux`](https://pt.wikipedia.org/wiki/Linux)\n* [`MacOS`](https://pt.wikipedia.org/wiki/Macos)\n* [`Windows`](https://pt.wikipedia.org/wiki/Microsoft_Windows)\n\n\n## Installation\n\n\nPIP\n\n```console\n$ pip install pysqlx-engine\n```\n\nPoetry\n\n```console\n$ poetry add pysqlx-engine\n```\n\n## Async Example\n\nCreate a `main.py` file and add the code examples below.\n\n```python\nfrom pysqlx_engine import PySQLXEngine\n\nasync def main():\n    db = PySQLXEngine(uri=\"sqlite:./db.db\")\n    await db.connect()\n\n    await db.execute(sql=\"\"\"\n        CREATE TABLE IF NOT EXISTS users (\n            id INTEGER PRIMARY KEY, \n            name TEXT, \n            age INT\n        )\n    \"\"\")\n    await db.execute(sql=\"INSERT INTO users (name, age) VALUES ('Rian', '28')\")\n    await db.execute(sql=\"INSERT INTO users (name, age) VALUES ('Carlos', '29')\")\n\n    rows = await db.query(sql=\"SELECT * FROM users\")\n\n    print(rows)\n\nimport asyncio\nasyncio.run(main())\n```\n\n## Sync Example\n\nCreate a `main.py` file and add the code examples below.\n\n```python\nfrom pysqlx_engine import PySQLXEngineSync\n\ndef main():\n    db = PySQLXEngineSync(uri=\"sqlite:./db.db\")\n    db.connect()\n\n    db.execute(sql=\"\"\"\n        CREATE TABLE IF NOT EXISTS users (\n            id INTEGER PRIMARY KEY, \n            name TEXT, \n            age INT\n        )\n    \"\"\")\n    db.execute(sql=\"INSERT INTO users (name, age) VALUES ('Rian', '28')\")\n    db.execute(sql=\"INSERT INTO users (name, age) VALUES ('Carlos', '29')\")\n\n    rows = db.query(sql=\"SELECT * FROM users\")\n\n    print(rows)\n\n# running the code\nmain()\n```\n\nRunning the code using the terminal\n\n\n```console\n$ python3 main.py\n```\nOutput\n\n```python\n[\n    BaseRow(id=1, name='Rian', age=28),  \n    BaseRow(id=2, name='Carlos', age=29)\n]\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Async and Sync SQL Engine for Python, with support for MySQL, PostgreSQL, SQLite and Microsoft SQL Server.",
    "version": "0.2.27",
    "project_urls": {
        "Documentation": "https://carlos-rian.github.io/pysqlx-engine",
        "Homepage": "https://carlos-rian.github.io/pysqlx-engine",
        "Repository": "https://github.com/carlos-rian/pysqlx-engine"
    },
    "split_keywords": [
        "async",
        "database",
        "sql",
        "engine",
        "fastapi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "88ab637b234fa3aaf0616cda6215e48263b5628d3de73ab6665d1b53b10711d7",
                "md5": "0563254f689b58cbd33e39f4beee27e9",
                "sha256": "d472b668fb046340903210df50b8355c4b0fd141e3b9ce1ed43fc1cc468ab1c8"
            },
            "downloads": -1,
            "filename": "pysqlx_engine-0.2.27-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0563254f689b58cbd33e39f4beee27e9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 27160,
            "upload_time": "2023-10-30T21:20:08",
            "upload_time_iso_8601": "2023-10-30T21:20:08.744938Z",
            "url": "https://files.pythonhosted.org/packages/88/ab/637b234fa3aaf0616cda6215e48263b5628d3de73ab6665d1b53b10711d7/pysqlx_engine-0.2.27-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3dbf0e1ef2d333d1c0c49fc5630ffd28d4fd6377e0fd19f5a00f4a68b65318bf",
                "md5": "ce18a3b6e88baf3edbe6007d1c931329",
                "sha256": "9e0c995c3830345ceb759ed1cf1045e7d97ef8a4320196aaf3a4db036e005dbb"
            },
            "downloads": -1,
            "filename": "pysqlx_engine-0.2.27.tar.gz",
            "has_sig": false,
            "md5_digest": "ce18a3b6e88baf3edbe6007d1c931329",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 20658,
            "upload_time": "2023-10-30T21:20:10",
            "upload_time_iso_8601": "2023-10-30T21:20:10.917804Z",
            "url": "https://files.pythonhosted.org/packages/3d/bf/0e1ef2d333d1c0c49fc5630ffd28d4fd6377e0fd19f5a00f4a68b65318bf/pysqlx_engine-0.2.27.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-30 21:20:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "carlos-rian",
    "github_project": "pysqlx-engine",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pysqlx-engine"
}
        
Elapsed time: 0.14532s