From ffcb1348c1a18af20780a44e0fa95fc17417ae61 Mon Sep 17 00:00:00 2001 From: Muralidhar Tellagapalli Date: Mon, 13 Oct 2025 15:30:23 +0530 Subject: [PATCH 1/6] Add parent-tap-stream-id key in metadata --- tap_intercom/schema.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tap_intercom/schema.py b/tap_intercom/schema.py index 3fb3a1c..0912ea7 100644 --- a/tap_intercom/schema.py +++ b/tap_intercom/schema.py @@ -40,6 +40,12 @@ def get_schemas(): ) mdata = metadata.to_map(mdata) + + # Check if the stream has any parent attribute + parent_class = getattr(stream_object, 'parent', None) + if parent_class and hasattr(parent_class, 'tap_stream_id'): + parent_tap_stream_id = parent_class.tap_stream_id + mdata = metadata.write(mdata, (), 'parent-tap-stream-id', parent_tap_stream_id) if stream_object.replication_key: mdata = metadata.write( From acdea2cb510d689618799cc4d00d84df0e2a5e1e Mon Sep 17 00:00:00 2001 From: Muralidhar Tellagapalli Date: Fri, 17 Oct 2025 13:02:16 +0530 Subject: [PATCH 2/6] Add validation tests for child stream and forced-replication-method metadata --- tests/base.py | 3 +++ tests/test_intercom_discovery.py | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/tests/base.py b/tests/base.py index f7ac3e0..5f89e37 100644 --- a/tests/base.py +++ b/tests/base.py @@ -27,6 +27,7 @@ class IntercomBaseTest(unittest.TestCase): PRIMARY_KEYS = "table-key-properties" FOREIGN_KEYS = "table-foreign-key-properties" REPLICATION_METHOD = "forced-replication-method" + EXPECTED_PARENT_STREAM = "expected-parent-stream" OBEYS_START_DATE = "obeys-start-date" API_LIMIT = "max-row-limit" INCREMENTAL = "INCREMENTAL" @@ -80,6 +81,7 @@ def expected_metadata(self): "admins": { self.PRIMARY_KEYS: {"id"}, self.REPLICATION_METHOD: self.FULL_TABLE, + self.EXPECTED_PARENT_STREAM: "admin_list", self.OBEYS_START_DATE : False }, "companies": { @@ -109,6 +111,7 @@ def expected_metadata(self): self.PRIMARY_KEYS: {"id"}, self.REPLICATION_METHOD: self.INCREMENTAL, self.REPLICATION_KEYS: {"updated_at"}, + self.EXPECTED_PARENT_STREAM: "conversations", self.OBEYS_START_DATE : True }, "contact_attributes": { diff --git a/tests/test_intercom_discovery.py b/tests/test_intercom_discovery.py index ad3476a..ab379dd 100644 --- a/tests/test_intercom_discovery.py +++ b/tests/test_intercom_discovery.py @@ -54,6 +54,8 @@ def test_run(self): expected_primary_keys = self.expected_primary_keys()[stream] expected_replication_keys = self.expected_replication_keys()[stream] expected_automatic_fields = expected_primary_keys | expected_replication_keys + expected_replication_method = self.expected_metadata()[stream].get(self.REPLICATION_METHOD) + expected_parent_stream = self.expected_metadata()[stream].get(self.EXPECTED_PARENT_STREAM) # Collecting actual values... schema_and_metadata = menagerie.get_annotated_schema(conn_id, catalog['stream_id']) @@ -72,6 +74,12 @@ def test_run(self): stream_properties[0].get( "metadata", {self.REPLICATION_KEYS: []}).get(self.REPLICATION_KEYS, []) ) + + actual_replication_method = stream_properties[0].get( + "metadata", {self.REPLICATION_METHOD: None}).get(self.REPLICATION_METHOD) + + actual_parent_stream_id = stream_properties[0].get( + "metadata", {}).get("parent-tap-stream-id") ########################################################################## ### metadata assertions ########################################################################## @@ -99,6 +107,12 @@ def test_run(self): # are given the inclusion of automatic in metadata. self.assertSetEqual(expected_automatic_fields, actual_automatic_fields) + # verify the replication method matches our expectations + self.assertEqual(expected_replication_method, actual_replication_method) + + # verify parent-tap-stream-id for child streams + self.assertEqual(expected_parent_stream, actual_parent_stream_id) + # Verify that all other fields have an inclusion of available # This assumes there are no unsupported fields for SaaS sources self.assertTrue( From e35a15e4dbb7de63eb05ab80dcec6dc0418c8b9e Mon Sep 17 00:00:00 2001 From: Muralidhar Tellagapalli Date: Fri, 17 Oct 2025 13:03:06 +0530 Subject: [PATCH 3/6] update tap-version --- CHANGELOG.md | 3 +++ setup.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 704b946..76fdde2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 2.2.4 + * Adds parent-tap-stream-id field to catalog for child streams [#84](https://github.com/singer-io/tap-intercom/pull/84) + ## 2.2.3 * Fix pylint errors [#83](https://github.com/singer-io/tap-intercom/pull/83) diff --git a/setup.py b/setup.py index a202b71..878cf98 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages setup(name='tap-intercom', - version='2.2.3', + version='2.2.4', description='Singer.io tap for extracting data from the Intercom API', author='jeff.huth@bytecode.io', classifiers=['Programming Language :: Python :: 3 :: Only'], From 907b82f4a305318079dc928584a7729034ca2369 Mon Sep 17 00:00:00 2001 From: Muralidhar Tellagapalli Date: Fri, 17 Oct 2025 15:17:17 +0530 Subject: [PATCH 4/6] Set parent-tap-stream-id as constant --- tests/base.py | 1 + tests/test_intercom_discovery.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/base.py b/tests/base.py index 5f89e37..ffbf0d2 100644 --- a/tests/base.py +++ b/tests/base.py @@ -27,6 +27,7 @@ class IntercomBaseTest(unittest.TestCase): PRIMARY_KEYS = "table-key-properties" FOREIGN_KEYS = "table-foreign-key-properties" REPLICATION_METHOD = "forced-replication-method" + PARENT_TAP_STREAM_ID = "parent-tap-stream-id" EXPECTED_PARENT_STREAM = "expected-parent-stream" OBEYS_START_DATE = "obeys-start-date" API_LIMIT = "max-row-limit" diff --git a/tests/test_intercom_discovery.py b/tests/test_intercom_discovery.py index ab379dd..05a7bb6 100644 --- a/tests/test_intercom_discovery.py +++ b/tests/test_intercom_discovery.py @@ -79,7 +79,7 @@ def test_run(self): "metadata", {self.REPLICATION_METHOD: None}).get(self.REPLICATION_METHOD) actual_parent_stream_id = stream_properties[0].get( - "metadata", {}).get("parent-tap-stream-id") + "metadata", {}).get(self.PARENT_TAP_STREAM_ID) ########################################################################## ### metadata assertions ########################################################################## From 98f1566a45bdbe8d795320409065aee5d66fa07d Mon Sep 17 00:00:00 2001 From: Muralidhar Tellagapalli Date: Fri, 17 Oct 2025 15:18:51 +0530 Subject: [PATCH 5/6] Remove trailing whitespace --- tap_intercom/schema.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tap_intercom/schema.py b/tap_intercom/schema.py index 0912ea7..be610da 100644 --- a/tap_intercom/schema.py +++ b/tap_intercom/schema.py @@ -40,7 +40,6 @@ def get_schemas(): ) mdata = metadata.to_map(mdata) - # Check if the stream has any parent attribute parent_class = getattr(stream_object, 'parent', None) if parent_class and hasattr(parent_class, 'tap_stream_id'): From 911da550da19d509b81822af2924ba12b93b6101 Mon Sep 17 00:00:00 2001 From: Muralidhar Tellagapalli Date: Fri, 17 Oct 2025 16:28:28 +0530 Subject: [PATCH 6/6] update tap-version to minor --- CHANGELOG.md | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 76fdde2..849c498 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## 2.2.4 +## 2.3.0 * Adds parent-tap-stream-id field to catalog for child streams [#84](https://github.com/singer-io/tap-intercom/pull/84) ## 2.2.3 diff --git a/setup.py b/setup.py index 878cf98..2fc8438 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages setup(name='tap-intercom', - version='2.2.4', + version='2.3.0', description='Singer.io tap for extracting data from the Intercom API', author='jeff.huth@bytecode.io', classifiers=['Programming Language :: Python :: 3 :: Only'],