Integration Architect (Presenter)
Push and pull queries are easier to understand if you view them in action.
This exercise continues with the PERSON_STATS table from Hands On: Stateful Aggregations (Materialized Views).
Issue a pull query on the PERSON_STATS table:
SELECT LATEST_LOCATION, LOCATION_CHANGES, UNIQUE_LOCATIONS
FROM PERSON_STATS WHERE PERSON = 'Allison';
Click Run query and view the returned LATEST_LOCATION, LOCATION_CHANGES, and UNIQUE_LOCATIONS.
Now issue a push query on the PERSON_STATS table:
SELECT LATEST_LOCATION, LOCATION_CHANGES, UNIQUE_LOCATIONS
FROM PERSON_STATS WHERE PERSON = 'Allison' EMIT CHANGES;
Next, in another window, or perhaps in the CLI, insert some more data into the MOVEMENTS stream on which the PERSON_STATS table is based:
INSERT INTO MOVEMENTS VALUES ('Robin', 'York');
INSERT INTO MOVEMENTS VALUES ('Robin', 'Leeds');
INSERT INTO MOVEMENTS VALUES ('Allison', 'Denver');
INSERT INTO MOVEMENTS VALUES ('Robin', 'Ilkley');
INSERT INTO MOVEMENTS VALUES ('Allison', 'Boulder');
You should see new entries, reflecting this new data, appearing in the results of the push query from step 2.
Kill the query with Stop. Push queries will run until they're manually killed.
We will only share developer content and updates, including notifications when new content is added. We will never send you sales emails. 🙂 By subscribing, you understand we will process your personal information in accordance with our Privacy Statement.
Push and pull queries are easier to understand when you see them in action. First, I wanna review the structure of the PERSON_STATS table from the last lesson. We're gonna issue a pull query on the PERSON_STATS table. You'll see the latest location, latest location changes, and unique locations. Next, we'll issue a push query on the PERSON_STATS table, where the person equals Allison. You'll see that the current aggregate results appear and that the query is still running. Off-screen, I'm gonna go and add a new movement event. Look, you see a new aggregate record show up and another new aggregate record show up. Push queries will run continuously until they're manually killed. Let's go ahead and kill this query. That's all for demonstrating push and pull queries.