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

Uploaded Source

Built Distribution

coopio-1.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coopio-1.0.tar.gz
  • Upload date:
  • Size: 10.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-1.0.tar.gz
Algorithm Hash digest
SHA256 51293ed0b0f9d6e12a6ea31afaaafffd3a6332d4a0f7a9c6bd1370ee58b3b5a2
MD5 e1caeb8fca318581f8e49c7fcdd74bb3
BLAKE2b-256 9682433648f4763f284246f7b97b2166929d600512184e556d96157fa7658b1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coopio-1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.9 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-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca63e923b9e833abf8a8c69634615d5db346cc4648895dc57a70962464b8f2e4
MD5 86ccd621404b5861a45a297a5661d3f5
BLAKE2b-256 3e19b8c100a4d2408a5bfb282dcac907a021b606f9a6c4e55dd7b944e0e678ec

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