forRowsWithMatchingids
Example code
# REST Data Provider with forRowsInRange function example
# This example fetches earthquake data and updates only rows within a magnitude range
provider: DATA_PROVIDER_REST
method: GET
url: https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson
useLocalCall: true
# Update existing records or inserts new ones based on ID matching.
forRowsWithMatchingIds: true
# Input parameters for the range values
parameters:
mag:
type: number
location: query
required: false
value: 2.0
dmin:
type: number
location: query
required: false
value: 5.0
# Transform the earthquake data
outputTransform: |
{
"earthquakes": features[].{
"id": id,
"place": properties.place,
"mag": properties.mag,
"time": properties.time,
"coordinates": geometry.coordinates,
"depth": geometry.coordinates[2]
}
}
operations:
- type: operation.delete-insert
table: earthquake_data
records: |
=$.earthquakes.{
"id": id,
"place": place,
"mag": mag,
"time": time,
"longitude": coordinates[0],
"latitude": coordinates[1],
"depth": depth
}Last updated
Was this helpful?