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.10.tar.gz (33.2 kB view details)

Uploaded Source

Built Distribution

epure-0.2.10-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for epure-0.2.10.tar.gz
Algorithm Hash digest
SHA256 2a4690d69e19d08d9bc2a532f1fbd54dd47b6079b37362a92a58c3782ddd3f2b
MD5 e2a0c22584a5680850bcb781a5b3abab
BLAKE2b-256 93be691f5718c3a3cd60e2b733d09a2576ce70d167c339acab1c95f2e3fe22a1

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for epure-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 e2341640a8636871ca0ab797b79c8546073c9d835830267acd9149ecd65f3493
MD5 ba95b0098841ecc94fb39c0fe2f421fd
BLAKE2b-256 1a025a8047ef48892c505f6d1c82d591bf2962132143e7ac4f69c304bc19c759

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