Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(taps): Log JSONPatch match count at the INFO level #1999

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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