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

Convert catalog to dict. Resolves is not subscriptable error #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions tap_marketo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
get_currently_syncing,
set_currently_syncing,
)
from singer.catalog import Catalog

REQUIRED_CONFIG_KEYS = [
"start_date",
Expand All @@ -33,6 +34,9 @@


def validate_state(config, catalog, state):
if isinstance(catalog, Catalog):
catalog = catalog.to_dict()

for stream in catalog["streams"]:
for mdata in stream['metadata']:
if mdata['breadcrumb'] == [] and mdata['metadata'].get('selected') != True:
Expand Down
3 changes: 3 additions & 0 deletions tap_marketo/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import tempfile

import singer
from singer.catalog import Catalog
from singer import metadata
from singer import bookmarks
from singer import utils
Expand Down Expand Up @@ -461,6 +462,8 @@ def sync(client, catalog, config, state):
else:
singer.log_info("Starting sync")

if isinstance(catalog, Catalog):
catalog = catalog.to_dict()
for stream in catalog["streams"]:
# Skip unselected streams.
mdata = metadata.to_map(stream['metadata'])
Expand Down