Conversation
| metadata = field_metadata[stream_name] | ||
|
|
||
| # existing field-level metadata from schema.py | ||
| md_list = field_metadata[stream_name] |
There was a problem hiding this comment.
What was the need to change the variable name from metadata to md_list?
There was a problem hiding this comment.
Renamed the local metadata variable to md_list because it conflicted with the Singer metadata module.
To avoid this naming clash, the Singer module is now aliased as mdata, ensuring all metadata operations (write, to_map, etc.) behave correctly.
Also added the required top-level metadata fields — inclusion and forced-replication-method — to align with Singer catalog specifications and client expectations.
There was a problem hiding this comment.
We don't have any test cases from the beginning for this tap. we have incorporate unittest. is there any reference. for this kind of scenario.
There was a problem hiding this comment.
Added test cases. for this change. please check
There was a problem hiding this comment.
Pull request overview
This PR adds forced replication method metadata to Eloqua tap streams, automatically setting INCREMENTAL for streams with an UpdatedAt property and FULL_TABLE otherwise.
Key Changes:
- Modified the
discoverfunction to detectUpdatedAtproperties and set appropriateforced-replication-methodmetadata - Added comprehensive test coverage to verify the metadata is correctly applied to all discovered streams
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tap_eloqua/discover.py | Adds logic to detect UpdatedAt property and write forced-replication-method metadata to stream catalog entries |
| test/test_discovery_metadata.py | Adds unit test verifying that forced-replication-method metadata is correctly set based on schema properties |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| schema = Schema.from_dict(schema_dict) | ||
| metadata = field_metadata[stream_name] | ||
| properties = schema_dict.get("properties", {}) | ||
| replication_key = "updatedAt" if "UpdatedAt" in properties else None |
There was a problem hiding this comment.
The replication_key is set to lowercase 'updatedAt' but the check is for 'UpdatedAt' with capital letters. This inconsistency could cause issues if the replication_key value is used elsewhere in the codebase expecting the correct casing.
| replication_key = "updatedAt" if "UpdatedAt" in properties else None | |
| replication_key = "UpdatedAt" if "UpdatedAt" in properties else None |
| # compute expected replication method from schema properties | ||
| schema_props = s.schema.to_dict().get("properties", {}) | ||
| expected_rep_method = "INCREMENTAL" if "UpdatedAt" in schema_props else "FULL_TABLE" | ||
|
|
||
| self.assertEqual(root.get("forced-replication-method"), | ||
| expected_rep_method, | ||
| msg=f"forced-replication-method mismatch for stream {s.stream}") |
There was a problem hiding this comment.
The test duplicates the logic from the discover function (checking for 'UpdatedAt' property). Consider testing against known stream fixtures with expected outcomes rather than replicating the implementation logic, which makes the test less effective at catching bugs.
| # compute expected replication method from schema properties | |
| schema_props = s.schema.to_dict().get("properties", {}) | |
| expected_rep_method = "INCREMENTAL" if "UpdatedAt" in schema_props else "FULL_TABLE" | |
| self.assertEqual(root.get("forced-replication-method"), | |
| expected_rep_method, | |
| msg=f"forced-replication-method mismatch for stream {s.stream}") | |
| # Use known expected replication methods for each stream | |
| expected_rep_methods = { | |
| "Contacts": "INCREMENTAL", | |
| "Accounts": "FULL_TABLE", | |
| "Activities": "INCREMENTAL", | |
| # Add other streams and their expected replication methods here | |
| } | |
| stream_name = s.stream | |
| self.assertIn(stream_name, expected_rep_methods, msg=f"Unknown stream {stream_name} in test fixture") | |
| expected_rep_method = expected_rep_methods[stream_name] | |
| self.assertEqual(root.get("forced-replication-method"), | |
| expected_rep_method, | |
| msg=f"forced-replication-method mismatch for stream {stream_name}") |
There was a problem hiding this comment.
This comment is consider. and made the changes. @RushiT0122
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| schema = Schema.from_dict(schema_dict) | ||
| metadata = field_metadata[stream_name] | ||
| properties = schema_dict.get("properties", {}) | ||
| replication_key = next((k for k in properties if k.lower() == "updatedat"), None) |
There was a problem hiding this comment.
The case-insensitive comparison k.lower() == 'updatedat' will fail if the property key is 'updatedAt' (camelCase). This logic assumes all property keys are lowercase, but the comparison converts them to lowercase for matching. Consider verifying that property keys in the schema are actually lowercase, or adjust the logic to handle camelCase properly (e.g., comparing against both 'updatedat' and 'updatedAt').
| replication_key = next((k for k in properties if k.lower() == "updatedat"), None) | |
| # Accept both "updatedAt" (camelCase) and "updatedat" (lowercase) as replication keys | |
| replication_key = next( | |
| (k for k in properties if k.lower() == "updatedat" or k == "updatedAt"), | |
| None | |
| ) |
There was a problem hiding this comment.
I think this comment is valid but you should explain inconsistency in the replication name and why this is handled like in the comment.
I will not hold the PR for this but please add the appropriate comment before merging.
* upgrade python and added unittests * Update tests/test_sync.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update tests/test_sync.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * review comments * resolve review comments * remove out of scope changes * request lib to latest * fix review comments * resolve review comments * resolve review comments * updated changelog --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Ranit Saha <ranit.saha@globallogic.com>
|
|
||
| ## [1.4.0] 2026-04-08 | ||
| - Added replication method into metadata [#49](https://github.com/singer-io/tap-eloqua/pull/49) | ||
| - Bump backoff, requests, pendulum, singer-python version [#50](https://github.com/singer-io/tap-eloqua/pull/50) |
There was a problem hiding this comment.
also update for adding unittests and integration tests
| command: | | ||
| source /usr/local/share/virtualenvs/tap-tester/bin/activate | ||
| stitch-validate-json /usr/local/share/virtualenvs/tap-eloqua/lib/python3.9/site-packages/tap_eloqua/schemas/*.json | ||
| stitch-validate-json /usr/local/share/virtualenvs/tap-eloqua/lib/python3.12/site-packages/tap_eloqua/schemas/*.json |
There was a problem hiding this comment.
please also add pylint, unittest test validation in config file.
Description of change
What changed
forced-replication-methodmetadata to all discovered streams intap_eloqua/discover.pyUpdatedAt(orupdatedAt) property are set toINCREMENTALFULL_TABLEmetadatavariable tomd_listto resolve naming conflict with the importedsinger.metadatamodule (aliased asmdata)backoff==2.2.1,requests==2.33.1,pendulum==3.2.0,singer-python==6.8.0Tests added
Unit tests (
tests/unittests/):Integration tests (
tests/):CI changes (
.circleci/config.yml)pylint tap_eloqua --disable=C,R,W) — enforces zero error/warning-level lint issuestests/unittests/in isolation using the tap's own virtualenvtap-testervirtualenv (required for Stitch test framework)Manual QA steps
python -m unittest discover -s tests/unittests -p 'test_*.py'and confirm all unit tests passforced-replication-methodin root metadata for each streamINCREMENTALstreams (e.g.accounts,contacts,campaigns) haveUpdatedAt/updatedAtin their schemaFULL_TABLEstreams (e.g.visitors, activity streams) do notRisks
forced-replication-methodmetadata is a catalog-level change; downstream targets or orchestrators that read this field may change sync behavior on next runRollback steps
Rollback steps
AI generated code
https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code