Esempio n. 1
0
def do_sync(config, state, catalog):
    api_key = config['api_key']
    start_date = config['start_date'] if 'start_date' in config else None
    # end_date = config['end_date'] if 'end_date' in config else None
    stream_ids_to_sync = set()

    for stream in catalog.get('streams'):
        mdata = metadata.to_map(stream['metadata'])
        if metadata.get(mdata, (), 'selected'):
            stream_ids_to_sync.add(stream['tap_stream_id'])

    for stream in catalog['streams']:
        if stream['tap_stream_id'] not in stream_ids_to_sync:
            continue
        singer.write_schema(stream['stream'], stream['schema'],
                            stream['key_properties'])

        if stream['stream'] in EVENT_MAPPINGS.values():
            get_incremental_pull(stream, ENDPOINTS['metric'], state, api_key,
                                 start_date)
        elif stream['stream'] in ADDITIONAL_PROPERTIES_KEYS:
            get_incremental_pull_additional_properties(stream,
                                                       ENDPOINTS['metric'],
                                                       state, api_key,
                                                       start_date)
        else:
            get_full_pulls(stream, ENDPOINTS[stream['stream']], api_key)
Esempio n. 2
0
def do_sync(config, state, catalog):
    api_key = config['api_key']
    start_date = config['start_date'] if 'start_date' in config else None

    for stream in catalog['streams']:
        singer.write_schema(stream['stream'], stream['schema'],
                            stream['key_properties'])
        if stream['stream'] in EVENT_MAPPINGS.values():
            get_incremental_pull(stream, ENDPOINTS['metric'], state, api_key,
                                 start_date)
        else:
            get_full_pulls(stream, ENDPOINTS[stream['stream']], api_key)
Esempio n. 3
0
def do_sync(config, state, catalog):
    api_key = config['api_key']
    start_date = config['start_date'] if 'start_date' in config else None

    stream_ids_to_sync = [
        c['tap_stream_id'] for c in catalog['streams']
        if c.get('schema').get('selected')
    ]

    for stream in catalog['streams']:
        if stream['tap_stream_id'] not in stream_ids_to_sync:
            continue
        singer.write_schema(stream['stream'], stream['schema'],
                            stream['key_properties'])
        if stream['stream'] in EVENT_MAPPINGS.values():
            get_incremental_pull(stream, ENDPOINTS['metric'], state, api_key,
                                 start_date)
        else:
            get_full_pulls(stream, ENDPOINTS[stream['stream']], api_key)