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')
    GresDb('postgres://postgres:postgres@localhost:5432',
    log_level=3).connect()

    # Alternative way of connection

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

    # 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.9.tar.gz (33.9 kB view details)

Uploaded Source

Built Distribution

epure-0.2.9-py3-none-any.whl (46.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for epure-0.2.9.tar.gz
Algorithm Hash digest
SHA256 971c81a2ebdec8dea94b146b9de33d0ff607a216ea6778a0848bae954610cd60
MD5 d8929126b6a98daf5302806c53956a23
BLAKE2b-256 63be5f55b879f17e553d286060c5527d714551546adddef9befd9ac088862e1a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epure-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 805c9bb0f03c10b31875f6d62cbf060249aed60117b770c9f33966d5ada84f28
MD5 8b4a6e0d187d5a517d8e077a65254b73
BLAKE2b-256 76391e4a92fdd7b01a7abb1d3e28cf46cf606317094430188c23deaf6dca5ed3

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