Using the Options Query

<< Click to Display Table of Contents >>

Navigation:  Integrating SQLstream Blaze with Other Systems > Reading Data into s-Server > Reading from Other Sources  > Reading from Kafka >

Using the Options Query

Previous pageReturn to chapter overviewNext page

You can use the Options Query property to create a configuration table. You can then use this table to update adapter options at runtime. You can use this, for example, to set the STARTING_OFFSET option from a table that contains the last offset.

The Options Query returns one row. Table column names should be set for property names and row value should be set for property value.

If you set the OPTIONS_QUERY property to

select * from conf

 

and that query returns 1 row with 1 column called DIRECTORY containing the value /user/myuser, then the adapter is configured with the DIRECTORY property set to /user/myuser.  Each time the adapter runs its configuration gets dynamically computed from the conf table. You can also use views for the OPTIONS_QUERY.

CREATE OR REPLACE FOREIGN STREAM testOut (

           OFFSET BIGINT NOT NULL,

           line VARCHAR(4096))

SERVER KAFKASERVER

OPTIONS (TOPIC 'testThroughput', OPTIONS_QUERY 'select lastOffset as STARTING_OFFSET from TEST.committedOffset');