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

Uploaded Source

Built Distribution

coopio-0.3-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coopio-0.3.tar.gz
  • Upload date:
  • Size: 2.7 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.3.tar.gz
Algorithm Hash digest
SHA256 8d55d09c898dd895bfd09970a4ff640670bed52ef46483385256edbea923847f
MD5 50f6517bd7810476879abe98b225de22
BLAKE2b-256 ad9d9c804bdca07af37951c7a5694c4d70aad4ca08f49e968263eb5744ff214a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coopio-0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 19de22c3c5ab034af30204f00eeaeb324f3926443dc7a4ac6c1ff0d881ad80b3
MD5 baa296aa9584ea9ae62387637656ff57
BLAKE2b-256 0db43bc22245b3412bfa5d3de5da05af2ee41d1e7e38170f9e645016374eb612

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