def check(self, logger: AirbyteLogger, config: Mapping[str, Any]) -> AirbyteConnectionStatus: """ Tests if the input configuration can be used to successfully connect to the destination with the needed permissions e.g: if a provided API token or password can be used to connect and write to the destination. """ try: # Verify write access by attempting to write and then delete to a random key client = KvDbClient(**config) random_key = str(uuid.uuid4()) client.write(random_key, {"value": "_airbyte_connection_check"}) client.delete(random_key) except Exception as e: traceback.print_exc() return AirbyteConnectionStatus( status=Status.FAILED, message=f"An exception occurred: {e}. \nStacktrace: \n{traceback.format_exc()}" ) else: return AirbyteConnectionStatus(status=Status.SUCCEEDED)
def teardown(config: Mapping): yield client = KvDbClient(**config) client.delete(list(client.list_keys()))