ormstorm


Nameormstorm JSON
Version 0.0.3.0 PyPI version JSON
download
home_page
SummarySmall library for easy work with databases.
upload_time2023-07-17 20:04:06
maintainer
docs_urlNone
authorMolchaliv
requires_python
license
keywords python orm database sql sqlite3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Welcome to ORMStorm

ORMStorm is a small library for easy work with databases.

## The key features are:

 - **Simplicity:** The library is very simple, and it won't take long to learn it.
 - **Coding speed:** Integrating the library into your projects won't take long.
 - **Dynamic:** Unlike others, this library will allow you to very quickly create new tables and add databases to them.

## Installing

    pip install ormstorm
   
## Usage

Using standard tables

```python
from ormstorm import Table, Types, Column, create_session  


class ExampleTable(Table): 
    __tablename__ = "example"  
      
    id = Column(Types.INTEGER, primary_key=True, autoincrement=True)  
    text = Column(Types.STRING)  
      
      
LocalSession = create_session("example.sqlite3", [ExampleTable])  
      
with LocalSession() as session:  
    session.insert(ExampleTable(text="Hello, world!"))
```

Using a dynamic table

```python
from ormstorm import DynamicTable, Types, Column, create_session  
      
      
LocalSession = create_session("example.sqlite3", [])  
      
with LocalSession() as session:  
    NewTable = DynamicTable(  
        "new_table", {"id": Column(Types.INTEGER, primary_key=True, autoincrement=True), "text": Column(Types.STRING)}  
    )  
      
    session.create(NewTable)  
    session.insert(NewTable(text="Easy use of dynamic tables!"))
```

## Magic filters

Magic filters is a special system that allows you to quickly write conditions for sql queries in the usual python style!
Magic filters currently support the following operators: `=`, `!=`, `>=`, `>`, `<=`, `<`, `&`, `|`, `~`

Simple use of magic filters:

```python
from ormstorm import Table, Types, Column, create_session


class ExampleTable(Table):
    __tablename__ = "example"

    id = Column(Types.INTEGER, primary_key=True, autoincrement=True)
    text = Column(Types.STRING)


LocalSession = create_session("example.sqlite3", [ExampleTable])

with LocalSession() as session:
    result = session.select(
        (ExampleTable.text == "Hello") | ((ExampleTable.id > 5) & (ExampleTable.id < 15))
    )
```

Instead of the usual `and` and `or`, `&` and `|` are used, respectively. Also, `~` is used instead of the `or` keyword.
It is also worth noting that some expressions should be wrapped in parentheses to avoid unexpected errors.

To select all data from a table, simply specify its class.

```python
result = session.select(ExampleTable)
```

## Documentation

At the moment, all documentation is located in the library itself. Each function and class has good documentation to understand what the function is for.

## Note

This library is strictly not recommended for use in large projects because of the small functionality!

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "ormstorm",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,orm,database,sql,sqlite3",
    "author": "Molchaliv",
    "author_email": "molchaliv666@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/0f/ae/e4b297ed30b2f213b34da8fb7d4b662b767aacc58ae5706687f5d55acbfc/ormstorm-0.0.3.0.tar.gz",
    "platform": null,
    "description": "\ufeff# Welcome to ORMStorm\r\n\r\nORMStorm is a small library for easy work with databases.\r\n\r\n## The key features are:\r\n\r\n - **Simplicity:** The library is very simple, and it won't take long to learn it.\r\n - **Coding speed:** Integrating the library into your projects won't take long.\r\n - **Dynamic:** Unlike others, this library will allow you to very quickly create new tables and add databases to them.\r\n\r\n## Installing\r\n\r\n    pip install ormstorm\r\n   \r\n## Usage\r\n\r\nUsing standard tables\r\n\r\n```python\r\nfrom ormstorm import Table, Types, Column, create_session  \r\n\r\n\r\nclass ExampleTable(Table): \r\n    __tablename__ = \"example\"  \r\n      \r\n    id = Column(Types.INTEGER, primary_key=True, autoincrement=True)  \r\n    text = Column(Types.STRING)  \r\n      \r\n      \r\nLocalSession = create_session(\"example.sqlite3\", [ExampleTable])  \r\n      \r\nwith LocalSession() as session:  \r\n    session.insert(ExampleTable(text=\"Hello, world!\"))\r\n```\r\n\r\nUsing a dynamic table\r\n\r\n```python\r\nfrom ormstorm import DynamicTable, Types, Column, create_session  \r\n      \r\n      \r\nLocalSession = create_session(\"example.sqlite3\", [])  \r\n      \r\nwith LocalSession() as session:  \r\n    NewTable = DynamicTable(  \r\n        \"new_table\", {\"id\": Column(Types.INTEGER, primary_key=True, autoincrement=True), \"text\": Column(Types.STRING)}  \r\n    )  \r\n      \r\n    session.create(NewTable)  \r\n    session.insert(NewTable(text=\"Easy use of dynamic tables!\"))\r\n```\r\n\r\n## Magic filters\r\n\r\nMagic filters is a special system that allows you to quickly write conditions for sql queries in the usual python style!\r\nMagic filters currently support the following operators: `=`, `!=`, `>=`, `>`, `<=`, `<`, `&`, `|`, `~`\r\n\r\nSimple use of magic filters:\r\n\r\n```python\r\nfrom ormstorm import Table, Types, Column, create_session\r\n\r\n\r\nclass ExampleTable(Table):\r\n    __tablename__ = \"example\"\r\n\r\n    id = Column(Types.INTEGER, primary_key=True, autoincrement=True)\r\n    text = Column(Types.STRING)\r\n\r\n\r\nLocalSession = create_session(\"example.sqlite3\", [ExampleTable])\r\n\r\nwith LocalSession() as session:\r\n    result = session.select(\r\n        (ExampleTable.text == \"Hello\") | ((ExampleTable.id > 5) & (ExampleTable.id < 15))\r\n    )\r\n```\r\n\r\nInstead of the usual `and` and `or`, `&` and `|` are used, respectively. Also, `~` is used instead of the `or` keyword.\r\nIt is also worth noting that some expressions should be wrapped in parentheses to avoid unexpected errors.\r\n\r\nTo select all data from a table, simply specify its class.\r\n\r\n```python\r\nresult = session.select(ExampleTable)\r\n```\r\n\r\n## Documentation\r\n\r\nAt the moment, all documentation is located in the library itself. Each function and class has good documentation to understand what the function is for.\r\n\r\n## Note\r\n\r\nThis library is strictly not recommended for use in large projects because of the small functionality!\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Small library for easy work with databases.",
    "version": "0.0.3.0",
    "project_urls": null,
    "split_keywords": [
        "python",
        "orm",
        "database",
        "sql",
        "sqlite3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68f1bf5b781449fca0835032d5fcf3441399f8fd56cb5024648f82dbbe98123a",
                "md5": "b11db5858982a4da4a81432448a5f2ae",
                "sha256": "b95d2faf99b3a4dccbca7b048271ab64c37a149bb09aee7da854632eb11163a3"
            },
            "downloads": -1,
            "filename": "ormstorm-0.0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b11db5858982a4da4a81432448a5f2ae",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9319,
            "upload_time": "2023-07-17T20:04:00",
            "upload_time_iso_8601": "2023-07-17T20:04:00.547166Z",
            "url": "https://files.pythonhosted.org/packages/68/f1/bf5b781449fca0835032d5fcf3441399f8fd56cb5024648f82dbbe98123a/ormstorm-0.0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0faee4b297ed30b2f213b34da8fb7d4b662b767aacc58ae5706687f5d55acbfc",
                "md5": "5fb983de0e58058fe520382628b50b80",
                "sha256": "79f94cc916b97c2e2400baec021b9faa30e2e542a8d80c864be7cb29c1d24246"
            },
            "downloads": -1,
            "filename": "ormstorm-0.0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5fb983de0e58058fe520382628b50b80",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8547,
            "upload_time": "2023-07-17T20:04:06",
            "upload_time_iso_8601": "2023-07-17T20:04:06.850454Z",
            "url": "https://files.pythonhosted.org/packages/0f/ae/e4b297ed30b2f213b34da8fb7d4b662b767aacc58ae5706687f5d55acbfc/ormstorm-0.0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-17 20:04:06",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ormstorm"
}
        
Elapsed time: 0.13760s