Skip to main content

purest architecture

Project description

Epure

Epure is agnostic ORM - you can store and retrieve data having no idea about database, table and columns. All technical details hidden from you. Care only about your business logic.

Installing

Install and update using pip:

    $ pip install -U epure

Install and update using poetry:

    $ poetry add epure

Connecting Epure to database

Create example class with Epure, create instance of it and read it from DB.

    # import connection functions from Epure
    from epure import GresDb
    from epure import connect

    # First way to connect database to epure

    # Format of string to connect ('database://user:password@host:port')
    connect(GresDb('postgres://postgres:postgres@localhost:5432',
    log_level=3))

    # Alternative way of connection

    db = GresDb('postgres://postgres:postgres@localhost:32', 
    # host="localhost", 
    port="5432", 
    # database="postgres", 
    # user="postgres", 
    password="postgres",
    log_level=3)
    connect(db)

    # log_level defines level of description of opertaions with DB in auto-generated file epure_db.log

A Simple Example

    # save this as epure_example.py
    from epure import epure

    # different types hints avalible
    import types

    # In order to save attributes of class to db, type hints is required!

    # decorate class by @epure() wrap function
    @epure()
    class Example:

        int_attr:int
        bool_attr:bool
        str_attr:str
        complex_attr:complex
        list_attr:list
        dict_attr:Dict[int, str]
        str_attr_with_default_val:str = 'example_str'
        epure_cls_attr:SomeEpureCls
        NoneType_attr:types.NoneType

    # creating instance of epurized Example class
    obj = Example()
    
    # assigning vals to instance
    obj.int_attr = 1
    obj.str_attr = "example"
    obj.list_attr = [1,2,3,4]

    #saving obj instance to database
    obj.save()

    # saved instance has attribute of node_id that is unique
    node_id = epure.node_id 
    
    # node_id is used to search epure objects and retrive them from DB via read() method
    res = epure.table.read(node_id=node_id)

Developers

Nikita Umarov (Pichugin), Pavel Pichugin

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

epure-0.2.5.tar.gz (31.9 kB view details)

Uploaded Source

Built Distribution

epure-0.2.5-py3-none-any.whl (45.3 kB view details)

Uploaded Python 3

File details

Details for the file epure-0.2.5.tar.gz.

File metadata

  • Download URL: epure-0.2.5.tar.gz
  • Upload date:
  • Size: 31.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.1 Windows/10

File hashes

Hashes for epure-0.2.5.tar.gz
Algorithm Hash digest
SHA256 bc17900c62cd0ff57c2ac0aa28234722293508946062fab7efe4fd6751215433
MD5 e7823a05484107d6b13584793a5a9bf1
BLAKE2b-256 78a0d7a88835fe8189f2796e5aee5b566538a4497d59669a04d103d93c8b8bf9

See more details on using hashes here.

File details

Details for the file epure-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: epure-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 45.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.1 Windows/10

File hashes

Hashes for epure-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d39859d3a24e45a6f59f65297bd515dcd54667852c71dc0ecace4580a8aa8165
MD5 538db955c9bf8f18720daafa6f09516c
BLAKE2b-256 9b57464e15bf345febad0c0f78b4dbd3bfecb0d24f91a9b8574e3324513bb59a

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