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

Uploaded Source

Built Distribution

coopio-1.7-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coopio-1.7.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for coopio-1.7.tar.gz
Algorithm Hash digest
SHA256 3a27998b4baf64f07dcd2a2d0b07ddd7f1b3cbbaacbb92993c1d1813e03f5170
MD5 7107390e69462222a60a1ce0d292b7b2
BLAKE2b-256 b252018fd2d6e0a51ce337bcbd3ecb2e49c6df9c89d95bed2261397ec5e4b96b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coopio-1.7-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for coopio-1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 085f3bcc81c22f8215717e44bfc9b97ff112472b9002210dc57612d001128631
MD5 fc402154e8f1fb7cda940c7048acc87e
BLAKE2b-256 feee89b1bc0033444c293935904a7248fbb5972f16bc759756d1cb3bb0f03665

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