Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.format(stream['id'], stream['dataSet']['id']))
# Get a Stream's metadata
retrieved_stream = streams.get(stream['id'])
domo.logger.info("Retrieved Stream {} containing DataSet {}".format(
retrieved_stream['id'], retrieved_stream['dataSet']['id']))
# List Streams
limit = 1000
offset = 0
stream_list = streams.list(limit, offset)
domo.logger.info("Retrieved a list containing {} Stream(s)".format(
len(stream_list)))
# Update a Stream's metadata
stream_update = CreateStreamRequest(dsr, UpdateMethod.REPLACE)
updated_stream = streams.update(retrieved_stream['id'], stream_update)
domo.logger.info("Updated Stream {} to update method: {}".format(
updated_stream['id'], updated_stream['updateMethod']))
# Search for Streams
stream_property = 'dataSource.name:' + dsr.name
searched_streams = streams.search(stream_property)
domo.logger.info("Stream search: there are {} Stream(s) with the DataSet "
"title: {}".format(len(searched_streams), dsr.name))
# Create an Execution (Begin an upload process)
execution = streams.create_execution(stream['id'])
domo.logger.info("Created Execution {} for Stream {}".format(
execution['id'], stream['id']))
# Get an Execution
chunks, in parallel. They are also useful with data sources that
are constantly changing/growing.
Streams Docs: https://developer.domo.com/docs/data-apis/data
'''
domo.logger.info("\n**** Domo API - Stream Examples ****\n")
streams = domo.streams
# Define a DataSet Schema to populate the Stream Request
dsr = DataSetRequest()
dsr.name = 'Leonhard Euler Party'
dsr.description = 'Mathematician Guest List'
dsr.schema = Schema([Column(ColumnType.STRING, 'Friend'),
Column(ColumnType.STRING, 'Attending')])
# Build a Stream Request
stream_request = CreateStreamRequest(dsr, UpdateMethod.APPEND)
# Create a Stream w/DataSet
stream = streams.create(stream_request)
domo.logger.info("Created Stream {} containing the new DataSet {}"
.format(stream['id'], stream['dataSet']['id']))
# Get a Stream's metadata
retrieved_stream = streams.get(stream['id'])
domo.logger.info("Retrieved Stream {} containing DataSet {}".format(
retrieved_stream['id'], retrieved_stream['dataSet']['id']))
# List Streams
limit = 1000
offset = 0
stream_list = streams.list(limit, offset)
domo.logger.info("Retrieved a list containing {} Stream(s)".format(