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

Uploaded Source

Built Distribution

coopio-1.4-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coopio-1.4.tar.gz
  • Upload date:
  • Size: 16.1 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.4.tar.gz
Algorithm Hash digest
SHA256 1385228eb23dd83d87eed9f07ebc02bed9c1e3d4e26ceeb08bfd9a2e4ae3bdbe
MD5 c7992c4f4dc17088c0c42c57b2aa36f1
BLAKE2b-256 ea521d1a570b815c923ce3580e257a8b53e5d503cf93c33395ea4626b552d65b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: coopio-1.4-py3-none-any.whl
  • Upload date:
  • Size: 20.8 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 01632254a1d01a0e1bd03b556a60da2912cf5c3ba1884802ce31fe66a40ff65e
MD5 06fda4a09d92d657a4f99a6f8396cd3f
BLAKE2b-256 ed62b5ed80085ef01608175b03865e685a1b50a48d784390653fba4cfb5eb107

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