Skip to content

Commit

Permalink
feat(taps): Log JSONPatch match count at the INFO level (#1999)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon authored Oct 6, 2023
1 parent cb56f86 commit c203b61
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion singer_sdk/helpers/jsonpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import logging
import typing as t

import memoization
Expand All @@ -11,6 +12,9 @@
import jsonpath_ng


logger = logging.getLogger(__name__)


def extract_jsonpath(
expression: str,
input: dict | list, # noqa: A002
Expand All @@ -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


Expand Down

0 comments on commit c203b61

Please sign in to comment.