Ejemplo n.º 1
0
def discover():
    raw_schemas = load_schemas()
    streams = []

    refs = load_schema_references()
    for schema_name, schema in raw_schemas.items():
        if schema_name not in Context.stream_objects:
            continue

        stream = Context.stream_objects[schema_name]()
        schema = singer.resolve_schema_references(schema, refs)

        # create and add catalog entry
        catalog_entry = {
            'stream': schema_name,
            'tap_stream_id': schema_name,
            'schema': schema,
            'metadata' : get_discovery_metadata(stream, schema),
            'key_properties': stream.key_properties,
            'replication_key': stream.replication_key,
            'replication_method': stream.replication_method,
            'column_order': [str(column) for column in schema['properties']]
        }
        streams.append(catalog_entry)

    return {'streams': streams}
Ejemplo n.º 2
0
def discover():
    initialize_shopify_client()  # Checking token in discover mode

    raw_schemas = load_schemas()
    streams = []

    refs = load_schema_references()
    for schema_name, schema in raw_schemas.items():
        if schema_name not in Context.stream_objects:
            continue

        stream = Context.stream_objects[schema_name]()

        # resolve_schema_references() is changing value of passed refs.
        # Customer is a stream and it's a nested field of orders and abandoned_checkouts streams
        # and those 3 _sdc fields are also added inside nested field customer for above 2 stream
        # so create a copy of refs before passing it to resolve_schema_references().
        refs_copy = copy.deepcopy(refs)
        catalog_schema = add_synthetic_key_to_schema(
            singer.resolve_schema_references(schema, refs_copy))

        # create and add catalog entry
        catalog_entry = {
            'stream': schema_name,
            'tap_stream_id': schema_name,
            'schema': catalog_schema,
            'metadata': get_discovery_metadata(stream, schema),
            'key_properties': stream.key_properties,
            'replication_key': stream.replication_key,
            'replication_method': stream.replication_method
        }
        streams.append(catalog_entry)

    return {'streams': streams}
Ejemplo n.º 3
0
def discover():
    initialize_shopify_client() # Checking token in discover mode

    raw_schemas = load_schemas()
    streams = []

    refs = load_schema_references()
    for schema_name, schema in raw_schemas.items():
        if schema_name not in Context.stream_objects:
            continue

        stream = Context.stream_objects[schema_name]()

        # create and add catalog entry
        catalog_entry = {
            'stream': schema_name,
            'tap_stream_id': schema_name,
            'schema': singer.resolve_schema_references(schema, refs),
            'metadata' : get_discovery_metadata(stream, schema),
            'key_properties': stream.key_properties,
            'replication_key': stream.replication_key,
            'replication_method': stream.replication_method
        }
        streams.append(catalog_entry)

    return {'streams': streams}