Skip to content

Instantly share code, notes, and snippets.

@MichaelDrogalis
Last active May 21, 2019 16:01
Show Gist options
  • Save MichaelDrogalis/a307941b015cdf723cd52cbf18a0b1cc to your computer and use it in GitHub Desktop.
Save MichaelDrogalis/a307941b015cdf723cd52cbf18a0b1cc to your computer and use it in GitHub Desktop.
INSERT INTO all_publications (author, title) VALUES ('C.S. Lewis', 'The Silver Chair');
INSERT INTO all_publications (author, title) VALUES ('George R. R. Martin', 'A Song of Ice and Fire');
INSERT INTO all_publications (author, title) VALUES ('C.S. Lewis', 'Perelandra');
INSERT INTO all_publications (author, title) VALUES ('J. R. R. Tolkien', 'The Hobbit');
INSERT INTO all_publications (author, title) VALUES ('J. R. R. Tolkien', 'The Lord of the Rings');
INSERT INTO all_publications (author, title) VALUES ('J. R. R. Tolkien', 'The Fellowship of the Ring');
CREATE STREAM all_publications (author VARCHAR, title VARCHAR) WITH (kafka_topic = 'publication_events', partitions = 1, key = 'author', value_format = 'avro');
CREATE STREAM george_martin WITH (kafka_topic = 'george_martin_books', partitions = 1) AS SELECT author, title FROM all_publications WHERE author = 'George R. R. Martin';
{
"tests": [
{
"name": "filter by author",
"statements": [
{"kind": "file", "file": "inputs.sql"},
{"kind": "file", "file": "statements.sql"},
],
"outputs": [
{
"topic": "george_martin_books",
"key": "George R. R. Martin",
"value": {
"AUTHOR": "George R. R. Martin",
"TITLE": "A Song of Ice and Fire"
}
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment