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, Dummy):

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

Uploaded Source

Built Distribution

coopio-0.2-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coopio-0.2.tar.gz
  • Upload date:
  • Size: 1.9 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.2.tar.gz
Algorithm Hash digest
SHA256 d4749780fb9f3ad2f5433ddc20a94e1e17033e73644c8d05f19809b7efde93f2
MD5 2c0b681e92240b3efde53f0504ea5118
BLAKE2b-256 71b9fe350a2c1fd314a32b5bdd3cd93982229e3f783195f3973370cc9108d9c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coopio-0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.5 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 777ac9aa6b3a7d679a62c75158eaacb46b25ca7a201478485776d2bb93ad69c2
MD5 2e82eb76bf46d82e29f903cc1ff10fca
BLAKE2b-256 cdcd233dcfd04aa8d7d2643c5645f28f8db3f59d5e127d9282312171738e28f3

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