Materialize Documentation
Join the Community github/materialize

CREATE SOURCE: Text over PubNub

CREATE SOURCE connects Materialize to an external data source and lets you interact with its data as if the data were in a SQL table.

This document details how to connect Materialize to a text–formatted PubNub channel.

WARNING! PubNub sources are volatile. Please make sure you understand the limitations of volatile sources.

Conceptual framework

Sources represent connections to resources outside Materialize that it can read data from. For more information, see API Components: Sources.

Syntax

CREATE MATERIALIZED SOURCE IF NOT EXISTS src_name ( col_name , ) FROM PUBNUB SUBSCRIBE KEY key CHANNEL channel FORMAT TEXT ENVELOPE NONE

with_options

WITH ( field = val , )
Field Use
MATERIALIZED Materializes the source’s data, which retains all data in memory and makes sources directly selectable. For more information, see API Components: Materialized sources.
src_name The name for the source, which is used as its table name within SQL.
col_name Override default column name with the provided identifier. If used, a col_name must be provided for each column in the created source.
SUBSCRIBE KEY The secret subscription key for your PubNub account.
CHANNEL The name of the channel to subscribe to.
WITH ( option_list ) Options affecting source creation. For more detail, see WITH options.
TEXT Format the source’s data as ASCII-encoded text.
ENVELOPE NONE (Default) Use an append-only envelope. This means that records will only be appended and cannot be updated or deleted.

WITH options

The following options are valid within the WITH clause.

Field Value type Description
(No options supported.)

Details

PubNub source details

A PubNub source represents a subscription to a single PubNub channel. The subscribe key you provide must have permission to access the channel. For more details, see Permission Management in the PubNub documentation.

Text format details

Text-formatted sources reads lines from a file.

Append-only envelope

Append-only envelope means that all records received by the source is treated as an insert. This is Materialize’s default envelope (i.e. if no envelope is specified), and can be specified with ENVELOPE NONE.

Examples

PubNub raw market data

CREATE MATERIALIZED SOURCE market_orders_raw FROM PUBNUB
SUBSCRIBE KEY 'sub-c-4377ab04-f100-11e3-bffd-02ee2ddab7fe'
CHANNEL 'pubnub-market-orders';

This creates a source that…

Did this info help?
Yes No