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

TDL-26228 New Stream addition #95

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
96d2297
added lead_describe, program_tags, tag_types impl
somethingmorerelevant Jul 16, 2024
2920ba2
update write_schema for lead_describe
somethingmorerelevant Jul 16, 2024
6f230a2
updated leads describe schema
somethingmorerelevant Jul 16, 2024
fab192b
patched schema for leads_describe
somethingmorerelevant Jul 16, 2024
5e20d77
updated schema def
somethingmorerelevant Jul 16, 2024
4d3a537
updated repl method
somethingmorerelevant Jul 17, 2024
ec261a0
added repl method code
somethingmorerelevant Jul 17, 2024
ab3f436
added repl method to metadata
somethingmorerelevant Jul 17, 2024
01c06ec
added forced repl method
somethingmorerelevant Jul 17, 2024
8653530
added activate version impl
somethingmorerelevant Jul 18, 2024
341ad3c
updated sync impl
somethingmorerelevant Jul 18, 2024
9d736c6
added schema message bef actv. version
somethingmorerelevant Jul 18, 2024
e066b5a
updated impl and schema
somethingmorerelevant Jul 22, 2024
63e4d6e
added stream impl
somethingmorerelevant Jul 22, 2024
232627f
update changelog
somethingmorerelevant Jul 22, 2024
625c626
added eof
somethingmorerelevant Jul 22, 2024
a0c239f
added new test scenario
somethingmorerelevant Jul 22, 2024
82947be
Update tap_marketo/sync.py
somethingmorerelevant Jul 31, 2024
5abfc2f
added new fields
somethingmorerelevant Aug 8, 2024
76dafa5
fixed review comments
somethingmorerelevant Aug 9, 2024
c31378b
Merge branch 'TDL-26228' of github.com:singer-io/tap-marketo into TDL…
somethingmorerelevant Aug 9, 2024
141cb40
fixed issue with program_tags
somethingmorerelevant Aug 9, 2024
4a4316c
fixed tag_types issue
somethingmorerelevant Aug 12, 2024
d8f5ff7
updated schema for programs
somethingmorerelevant Aug 21, 2024
7ef5391
* Add new field to activitiy streams
Sep 19, 2024
ccbef1c
* Update tests
Sep 19, 2024
8096123
Merge branch 'master' into TDL-26228
somethingmorerelevant Sep 23, 2024
d8ecfc9
updated sync max_export to support float
somethingmorerelevant Sep 23, 2024
3688203
Merge branch 'TDL-26228' of github.com:singer-io/tap-marketo into TDL…
somethingmorerelevant Sep 23, 2024
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 2.7.0
* New Streams added (Describe Leads,Program Tags, Tag Types) [#95](https://github.com/singer-io/tap-marketo/pull/95)

## 2.6.1
* Log Corona warning only if the leads and activities_* stream are selected [#94](https://github.com/singer-io/tap-marketo/pull/94)

Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from setuptools import setup

setup(name='tap-marketo',
version='2.6.1',
version='2.7.0',
description='Singer.io tap for extracting data from the Marketo API',
author='Stitch',
url='http://singer.io',
Expand Down Expand Up @@ -32,6 +32,9 @@
"activity_types.json",
"campaigns.json",
"programs.json",
"leads_describe.json",
"program_tags.json",
"tag_types.json"
]
},
include_package_data=True,
Expand Down
18 changes: 16 additions & 2 deletions tap_marketo/discover.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
LISTS_AUTOMATIC_INCLUSION = frozenset(["id", "name", "createdAt", "updatedAt"])
PROGRAMS_AUTOMATIC_INCLUSION = frozenset(["id", "createdAt", "updatedAt"])
CAMPAIGNS_AUTOMATIC_INCLUSION = frozenset(["id", "createdAt", "updatedAt"])
LEADS_DESCRIBE_AUTOMATIC_INCLUSION = frozenset(["id","displayName"])
PROGRAM_TAGS_AUTOMATIC_INCLUSION = frozenset(["tagType","program_id"])
TAG_TYPES_AUTOMATIC_INCLUSION = frozenset(["tagType"])

LEAD_REQUIRED_FIELDS = frozenset(["id", "updatedAt", "createdAt"])

Expand Down Expand Up @@ -82,6 +85,7 @@ def get_activity_type_stream(activity):
"activityDate": {"type": ["null", "string"], "format": "date-time"},
"activityTypeId": {"type": ["null", "integer"]},
"campaignId": {"type": ["null", "integer"]},
"actionResult": {"type": ["null", "string"]},
}

for prop in properties:
Expand Down Expand Up @@ -190,6 +194,9 @@ def discover_catalog(name, automatic_inclusion, **kwargs):

with open(path, "r") as f:
discovered_schema = json.load(f)
repl_method = discovered_schema.get("replication_method", None)
key_props = discovered_schema.get("key_properties", None)


for field in discovered_schema["schema"]["properties"]:
if field in automatic_inclusion:
Expand All @@ -202,8 +209,12 @@ def discover_catalog(name, automatic_inclusion, **kwargs):
if stream_automatic_inclusion:
mdata = metadata.write(mdata, (), 'inclusion', 'automatic')

# The steams using discover_catalog all use "id" as the key_properties
mdata = metadata.write(mdata, (), 'table-key-properties', ['id'])
if not key_props:
key_props = []
mdata = metadata.write(mdata, (), 'table-key-properties', key_props)

if repl_method:
mdata = metadata.write(mdata, (), 'forced-replication-method', repl_method)

discovered_schema["metadata"] = metadata.to_list(mdata)
return discovered_schema
Expand All @@ -217,5 +228,8 @@ def discover(client):
streams.append(discover_catalog("campaigns", CAMPAIGNS_AUTOMATIC_INCLUSION))
streams.append(discover_catalog("lists", LISTS_AUTOMATIC_INCLUSION))
streams.append(discover_catalog("programs", PROGRAMS_AUTOMATIC_INCLUSION))
streams.append(discover_catalog("leads_describe", LEADS_DESCRIBE_AUTOMATIC_INCLUSION))
streams.append(discover_catalog("program_tags", PROGRAM_TAGS_AUTOMATIC_INCLUSION))
streams.append(discover_catalog("tag_types", TAG_TYPES_AUTOMATIC_INCLUSION))
json.dump({"streams": streams}, sys.stdout, indent=2)
singer.log_info("Finished discover")
45 changes: 45 additions & 0 deletions tap_marketo/schemas/leads_describe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"tap_stream_id": "leads_describe",
"stream": "leads_describe",
"key_properties": ["id"],
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "integer"
},
"displayName": {
"type": ["null", "string"]
},
"dataType": {
"type": ["null", "string"]
},
"length": {
"type": ["null", "integer"]
},
"soap": {
"type": ["null", "object"],
"properties": {
"name": {
"type": ["null", "string"]
},
"readOnly": {
"type": ["null", "boolean"]
}
}
},
"rest": {
"type": ["null", "object"],
"properties": {
"name": {
"type": ["null", "string"]
},
"readOnly": {
"type": ["null", "boolean"]
}
}
}
}
}
}
21 changes: 21 additions & 0 deletions tap_marketo/schemas/program_tags.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"tap_stream_id": "program_tags",
"stream": "program_tags",
"replication_method": "FULL_TABLE",
"key_properties": [],
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"program_id": {
"type": "integer"
},
"tagType": {
"type": [ "null", "string"]
},
"tagValue": {
"type": [ "null", "string"]
}
}
}
}
8 changes: 7 additions & 1 deletion tap_marketo/schemas/programs.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@
"format": "date-time"
},
"name": {
"type": "string"
"type": ["null", "string"]
},
"sfdcName": {
"type": ["null", "string"]
},
"sfdcId": {
"type": ["null", "string"]
},
"description": {
"type": ["null", "string"]
Expand Down
21 changes: 21 additions & 0 deletions tap_marketo/schemas/tag_types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"tap_stream_id": "tag_types",
"stream": "tag_types",
"key_properties": [],
"replication_method": "FULL_TABLE",
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"applicableProgramTypes": {
"type": ["null", "string"]
},
"tagType": {
"type": ["null", "string"]
},
"required": {
"type": ["boolean", "null"]
}
}
}
}
Loading