Skip to content

Generic sql extension

superxan edited this page Apr 14, 2022 · 2 revisions

Overview

Make eKuiper supports sql syntax based database access from/to(source & sink). Provide this ability as native plugin. provide a list of databases support and switch them by build tag. default support mysql.

Rationality

Go native package sql provides a generic interface around SQL (or SQL-like) databases. The sql package must be used in conjunction with a database driver. Once driver imported, user can use APIs provided by sql package to interact with Target Database:

There is a package which wrapper the above operation to support a number of databases more easily. users just need to provide the connection info to the target database, then he can get a sql.DB with which he can run the SQL statement

SQL Source

Sql source pull the database periodically to get the data and send the data rows one by one as stream.

Sql Source Name: sql

the configuration for Source include

  • ConnectionUrl: the target database address info. Example
  • SqlCommand: sql statement against the target database
  • Interval: sql statement running interval

SQL Sink

Sql sink write the result data to the target database.

Sql Source Name: sql

  • ConnectionUrl: the target database address info. Example
  • SqlCommand: sql statement against the target database
  • Table: table name for the target
  • Fields: Table field collection