Skip to content

Commit

Permalink
GH-904 - Added unit tests and addressed remaining comments on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
TejasRGitHub authored and trajopadhye committed Jan 30, 2024
1 parent 2fd031b commit 75fa5ee
Show file tree
Hide file tree
Showing 3 changed files with 254 additions and 21 deletions.
17 changes: 4 additions & 13 deletions backend/dataall/modules/dataset_sharing/aws/glue_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,8 @@ def get_source_catalog(self):
return Catalog(account_id=linked_database.get('CatalogId'),
database_name=linked_database.get('DatabaseName'),
region=linked_database.get('Region', self._region))

except self._client.exceptions.EntityNotFoundException as enoFnd:
log.exception(f'Could not fetch source catalog details for database {self._database} due to {enoFnd}')
raise enoFnd
except Exception as e:
log.exception(f'Error fetching source catalog details for database {self._database} due to {e}')
except self._client.exceptions.EntityNotFoundException as e:
log.exception(f'Could not fetch source catalog details for database {self._database} due to {e}')
raise e
return None

Expand All @@ -204,13 +200,8 @@ def get_database_tags(self):
resource_arn = f'arn:aws:glue:{region}:{account_id}:database/{database}'
response = self._client.get_tags(ResourceArn=resource_arn)
tags = response['Tags']

log.info(f'Successfully retrieved tags: {tags}')

return tags
except self._client.exceptions.EntityNotFoundException as entNotFound:
log.exception(f'Could not get tags for database {database} due to {entNotFound}')
raise entNotFound
except Exception as e:
log.exception(f'Error fetching tags for {database} due to {e}')
except self._client.exceptions.EntityNotFoundException as e:
log.exception(f'Could not get tags for database {database} due to {e}')
raise e
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import logging

from dataall.base.db import Engine
from dataall.modules.dataset_sharing.db.share_object_repositories import ShareObjectSM, ShareObjectRepository, \
ShareItemSM
from dataall.modules.dataset_sharing.services.share_processors.lf_process_cross_account_share import \
ProcessLFCrossAccountShare
from dataall.modules.dataset_sharing.services.share_processors.lf_process_same_account_share import \
Expand Down Expand Up @@ -297,7 +295,7 @@ def create_lf_processor(session,
processor.verify_catalog_ownership()

return processor
# Todo - Add an exception in case GlueClient initialization fails ??

except Exception as e:
log.error(f"Error creating LF processor: {e}")
for table in shared_tables:
Expand Down
Loading

0 comments on commit 75fa5ee

Please sign in to comment.