Skip to content

Commit

Permalink
doc: add raw examples of produce records
Browse files Browse the repository at this point in the history
  • Loading branch information
fraidev committed Nov 26, 2024
1 parent 9255d78 commit 4c60655
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,22 @@ $ fluvio consumer list
my-http-sink http-sink-topic 0 0 3s
```

## Insert Usage Example
#### Example

SQL database (Postgres):
```
CREATE TABLE topic_message (device_id int, record json);
```

The connector reads records from the Fluvio topic and sends them to the SQL database. The records are expected to be in JSON format.

Than you can produce records like this:

```json
echo {"Insert":{"table":"test_postgres_consumer_offsets","values":[{"column":"device_id","raw_value":"0","type":"Int"},{"column":"record","raw_value":"{\"device\":{\"device_id\":0}}","type":"Json"}]}} | fluvio produce http-sink-topic
```

## Insert Usage Example with `json-sql` SmartModule
Let's look at the example of the connector with one transformation named [infinyon/json-sql](https://github.com/infinyon/fluvio-connectors/blob/main/smartmodules/json-sql/README.md). The transformation takes
records in JSON format and creates SQL insert operation to `topic_message` table. The value from `device.device_id`
JSON field will be put to `device_id` column and the entire json body to `record` column.
Expand Down

0 comments on commit 4c60655

Please sign in to comment.