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

Uploaded Source

Built Distribution

epure-0.2.8-py3-none-any.whl (46.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: epure-0.2.8.tar.gz
  • Upload date:
  • Size: 33.8 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.8.tar.gz
Algorithm Hash digest
SHA256 fbc6db5b1ad612a8303205a011b4fe59d7350c54fb778e5b5e11f4c21a8ec452
MD5 8068bc03a9ad3e10d5506e269d53fb19
BLAKE2b-256 436cc26358007dbb906b402655423da9b7bedbcfcf392c2c9e20b8164e5c862e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: epure-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 46.1 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 97aa8837750e45f827ff48654eaa96f4ffa0b94cdf5b3886508c5275f0ede4df
MD5 53322c9d63fdc7912c399ffcb2cc98c9
BLAKE2b-256 4611c7e306e58662c88421db7fe2c9a469f629345287317c3ae3d39656d7f3a1

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