Last active
August 26, 2019 05:41
-
-
Save reaganscofield/818c47a5165340e58e4725e907ad455a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class GetIOTFromStaging: | |
| def __init__(self, fields: list, username: str, config_path: str, retries: int=0): | |
| self.fields = fields | |
| self.username = username | |
| self.config_path = config_path | |
| self.retries = retries | |
| self.frequency = 1 | |
| self.source = "production" | |
| def get_data_and_upload_to_bq(self): | |
| uploads = [] | |
| upload_data = { | |
| "fields_list": self.fields, | |
| "username": self.username, | |
| "config_path": self.config_path, | |
| "reties": self.retries, | |
| "frequency": self.frequency, | |
| "source": self.source | |
| } | |
| uploads.append(upload_data) | |
| if len(upload_data) > 0: | |
| for data in uploads: | |
| self.upload_to_bg(data) | |
| upload_to_bg = lambda self, data : print(data) | |
| fields = ['Science', 'Technology', 'Physics', 'Maths', 'Aeronautics'] | |
| username = 'jhonsnow' | |
| path = "../dir/server/configuration" | |
| retries = 10 | |
| get_data = GetIOTFromStaging(fields, username, path, retries) | |
| get_data.get_data_and_upload_to_bq() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment