From c203b619e2852a31f63ef489f4ef263b7fd2e576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Fri, 6 Oct 2023 07:29:33 -0600 Subject: [PATCH] feat(taps): Log JSONPatch match count at the INFO level (#1999) --- singer_sdk/helpers/jsonpath.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/singer_sdk/helpers/jsonpath.py b/singer_sdk/helpers/jsonpath.py index 9e2956f19..82c514b41 100644 --- a/singer_sdk/helpers/jsonpath.py +++ b/singer_sdk/helpers/jsonpath.py @@ -2,6 +2,7 @@ from __future__ import annotations +import logging import typing as t import memoization @@ -11,6 +12,9 @@ import jsonpath_ng +logger = logging.getLogger(__name__) + + def extract_jsonpath( expression: str, input: dict | list, # noqa: A002 @@ -27,7 +31,11 @@ def extract_jsonpath( compiled_jsonpath = _compile_jsonpath(expression) match: jsonpath_ng.DatumInContext - for match in compiled_jsonpath.find(input): + matches = compiled_jsonpath.find(input) + + logger.info("JSONPath matches: %d", len(matches)) + + for match in matches: yield match.value