Skip to main content

Library for creating data services

Project description

coopio

Library for creating data services

CsvDataService Example:

class Dummy:
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c

    def __str__(self):
        return f"a: {self.a}, b: {self.b}, c: {self.c}"

    def __repr__(self):
        return self.__str__()

class CsvDataService_Dummy(ICsvDataService):

    def __init__(self, data_file_path: str):
        ICsvDataService.__init__(self, data_file_path)

    def translate_from_data_rows(self, df: pd.DataFrame) -> List[T]:
        ret_dummies = []

        for i, row in df.iterrows():
            new_dummy = Dummy(
                a=row['a'],
                b=row['b'],
                c=row['c']
            )
            ret_dummies.append(new_dummy)

        return ret_dummies

After Establishing the data service, data can be stored or retrieved as follows:

    dummies = []
    for ii in range(0, 5):
        dummies.append(Dummy(ii, 2, 3))

    data_service.add_or_update(obj_identifier='a', objs=dummies)

    stored = data_service.retrieve_data(obj_identifier='a')

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

coopio-0.5.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

coopio-0.5-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file coopio-0.5.tar.gz.

File metadata

  • Download URL: coopio-0.5.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for coopio-0.5.tar.gz
Algorithm Hash digest
SHA256 f8d51859e9c137f6c38504d80895fc56ae2125695369f3d5ab667c2add35ab2c
MD5 3e0e8b16ec08e660c3258bf17b2f9d18
BLAKE2b-256 c947c8c95ba7e501386b70776d6d820ae6214196582f55f70933e8af778dfc28

See more details on using hashes here.

File details

Details for the file coopio-0.5-py3-none-any.whl.

File metadata

  • Download URL: coopio-0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3

File hashes

Hashes for coopio-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 323aff3a1c3ace7ed8b027d9b8a354253d9df7d62c3e3607292c1cd112890ed1
MD5 20aea87fa904dec33608e8e298b5ddff
BLAKE2b-256 b8e51b5699509f9c79d36320b3741574c2ea15f8ffe91a0a1a48220fee7ac233

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