Created
October 25, 2020 18:13
-
-
Save mesmacosta/bef27cb31376f615d6302819f8c1d6e6 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
| def sync(event, context): | |
| """Sync PostgreSQL metadata with Google Data Catalog | |
| """ | |
| try: | |
| # Log out the message that triggered the function | |
| logging.info('This Function was triggered by messageId {} published at {}'. | |
| format(context.event_id, context.timestamp)) | |
| logging.info('Starting sync logic.') | |
| datacatalog_cli.PostgreSQL2DatacatalogCli().run(_get_connector_run_args()) | |
| logging.info('Sync execution done.') | |
| return 'ok', 200 | |
| except PermissionError as err: | |
| logging.error('Error executing sync: %s', str(err)) | |
| return 'authentication denied', 401 | |
| except UserWarning as warn: | |
| logging.error('Error executing sync: %s', str(warn)) | |
| return str(warn), 400 | |
| except Exception as err: | |
| logging.error('Error executing sync: %s', str(err)) | |
| return 'failed to sync', 500 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment