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

Uploaded Source

Built Distribution

epure-0.2.7-py3-none-any.whl (45.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: epure-0.2.7.tar.gz
  • Upload date:
  • Size: 33.5 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.7.tar.gz
Algorithm Hash digest
SHA256 77921d0f248276bcdc3d704590509adeda4aaea66104444f8ab1a230bf9161e2
MD5 3204cf2353f1ddacd976f69481588817
BLAKE2b-256 fda98aa43343be1a459e6427fc7786bd7cb7c28f39ed698706a0e5f48a9ed74d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epure-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 45.6 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 85b76999c8fcd26b38c9a6e056d6fe272d5f5efb45615ac5637fd2b75c222b96
MD5 095e33755c22da5e10118ff7b9727e95
BLAKE2b-256 2b37be19aff0fa4b234db018a9408224f4b73947f9adc40ae1d888ff58aad08a

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