-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(ingestion/fivetran): Connector performance optimization #10556
perf(ingestion/fivetran): Connector performance optimization #10556
Conversation
@@ -66,7 +66,7 @@ class FivetranSource(StatefulIngestionSourceBase): | |||
platform: str = "fivetran" | |||
|
|||
def __init__(self, config: FivetranSourceConfig, ctx: PipelineContext): | |||
super().__init__(config, ctx) | |||
super(FivetranSource, self).__init__(config, ctx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes happen automatically. Let me revert it
@@ -76,7 +77,7 @@ def _initialize_fivetran_variables( | |||
) | |||
|
|||
def _query(self, query: str) -> List[Dict]: | |||
logger.debug(f"Query : {query}") | |||
logger.debug("Query : {}".format(query)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes happen automatically. Let me revert it
SELECT connector_id, | ||
sync_id, | ||
message_event, | ||
message_data, | ||
time_stamp | ||
FROM {self.db_clause}log | ||
WHERE message_event in ('sync_start', 'sync_end')""" | ||
FROM {}log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use named format args
e.g. "{foo}".format(foo='whatever')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…ance-optimization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tweaking variable naming / docs, otherwise looks good
metadata-ingestion/src/datahub/ingestion/source/fivetran/config.py
Outdated
Show resolved
Hide resolved
metadata-ingestion/src/datahub/ingestion/source/fivetran/config.py
Outdated
Show resolved
Hide resolved
…into Fivetran-connector-performance-optimization
@@ -208,50 +214,61 @@ def _get_jobs_list( | |||
) | |||
return jobs | |||
|
|||
def _get_user_email(self, user_id: Optional[str]) -> Optional[str]: | |||
@functools.lru_cache() | |||
def get_user_email(self, user_id: str) -> Optional[str]: | |||
if not user_id: | |||
return None | |||
user_details = self._query( | |||
self.fivetran_log_query.get_user_query(user_id=user_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this sending one query per user? ideally this would also do a bulk fetch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Checklist