Download data_pipeline/interfaces/api_client.py from mlnsio/text2sql: direct link, hf CLI and curl.
- Browser
- Download file 734 Bytes
-
https://huggingface.co/spaces/mlnsio/text2sql/resolve/main/data_pipeline/interfaces/api_client.py
- Command line
-
hf download hf://spaces/mlnsio/text2sql/data_pipeline/interfaces/api_client.py
-
curl -L -o api_client.py https://huggingface.co/spaces/mlnsio/text2sql/resolve/main/data_pipeline/interfaces/api_client.py
734 Bytes
| """ | |
| Interface for API clients | |
| """ | |
| from abc import ABC, abstractmethod | |
| class DataClient(ABC): | |
| """ | |
| Abstract class for API clients | |
| """ | |
| def extract(self): | |
| """ | |
| Extract data from API | |
| """ | |
| if self.api_url is None: | |
| raise Exception("No API URL provided") | |
| def transform(self): | |
| """ | |
| Placeholder method for future transformation logic. | |
| """ | |
| self.transformed_data = self.api_response | |
| def load(self): | |
| """ | |
| Load data into target model | |
| """ | |
| raise Exception("No model to transform") | |
| def run(self) -> None: | |
| self.extract() | |
| self.transform() | |
| self.load() | |