Skip to content

SQL Sink

updatable

The sink will write the result to the database.

Properties

Property nameOptionalDescription
Server AddressfalseThe url of the target database
Table NamefalseThe table name of the database
Tag FieldstrueThe fields to be inserted to. The result map and the database should both have these fields. If not specified, all fields in the result map will be inserted.

Other common sink properties are supported. Please refer to the sink common properties for more information.

Database Connection Address

Database connection address reference:

databaseurl sample
mysqlmysql://username:password@127.0.0.1:3306/testdb
sql serversqlserver://username:password@127.0.0.1:1433/testdb
postgrespostgres://username:password@127.0.0.1:5432/testdb
oracleoracle://username:password@127.0.0.1:1521/testdb
sqlitesqlite:/tmp/test.db

Sample

The following is an example of writing device data collected by the data collection module into a MySQL database.

  • Filter the points that need to be stored in MySQL in the SQL editor: deviceid, devicename, temp
sql_sink_example1
  • Add SQL Sink action
    • Click the Test Connection button to test the database connection status
    • Write deviceid, devicename, temp data into table table1 of MySQL database test.
sql_sink_example2

TIP

Table table1 needs to be created in advance in the MySQL database, and fields with the same column names deviceid, devicename, and temp exist, and the data types must be consistent.