This repository has been archived by the owner on Apr 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Description ## What is the current behavior? Currently, the dataframe dataset is not supported. closes: #18 #21 ## What is the new behavior? Added dataframe dataset. ## Does this introduce a breaking change? Nope ### Checklist - [ ] Created tests which fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --------- Co-authored-by: Wei Lee <[email protected]>
- Loading branch information
1 parent
fedd884
commit 482c23a
Showing
18 changed files
with
331 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/universal_transfer_operator/data_providers/dataframe/base.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Iterator | ||
|
||
import pandas as pd | ||
from universal_transfer_operator.data_providers.base import DataProviders, DataStream | ||
from universal_transfer_operator.datasets.dataframe.base import Dataframe | ||
|
||
|
||
class DataframeProvider(DataProviders[Dataframe]): | ||
"""Base class to import dataframe implementation. We intend to support different implementation of dataframes.""" | ||
|
||
def __init__( | ||
self, | ||
dataset: Dataframe, | ||
) -> None: | ||
self.dataset = dataset | ||
super().__init__(dataset=self.dataset) | ||
|
||
def read(self) -> Iterator[Dataframe]: | ||
"""Read from dataframe dataset and write to local reference locations or dataframes""" | ||
raise NotImplementedError | ||
|
||
def write(self, source_ref: pd.DataFrame | DataStream) -> DataframeProvider: # type: ignore | ||
"""Write the data to the dataframe dataset or filesystem dataset""" | ||
raise NotImplementedError | ||
|
||
def serialize(self): | ||
"""Store in the metadata DB if Dataframe""" | ||
raise NotImplementedError | ||
|
||
@staticmethod | ||
def deserialize(data: dict, version: int): | ||
"""Extract from metadata DB""" | ||
raise NotImplementedError | ||
|
||
def is_native_path_available( | ||
self, | ||
source_dataset: Dataframe, # skipcq PYL-W0613, PYL-R0201 | ||
) -> bool: | ||
""" | ||
Check if there is an optimised path for source to destination. | ||
:param source_dataset: Dataframe from which we need to transfer data | ||
""" | ||
return False |
Oops, something went wrong.