State

[Progress record]:

Proposed time: 2022/05/08

Discussion time:

Acceptance time:

Completion time: 2022/06/08

issues]: https://github.com/apache/incubator-linkis/projects/12

[email]:leojie1314@gmail.com

[release]:

[proposer]:  leojie

Motivation & Background

For example, the JDBC engine of Linkis supports that when only one engine instance is started, you can switch and connect to different JDBC data sources within the engine by using the data source switching identifier specified when submitting the sql script.

Basic concept

Expect to achieve goals

  • Support Linkis to specify the data source connection name when submitting scripts
  • Support Linkis JDBC engine to obtain data source connection information according to the incoming data source connection name when executing sql script, and then construct the corresponding database connection pool.

Implementation plan

  • When the script submits a request to the /api/rest_j/v1/entrance/submit interface, pass in the dataSources parameter
  • In the JDBCEngineConnExecutor, if the dataSources pass value is obtained, it will obtain the data source connection information according to the dataSource name, then construct the corresponding data source connection pool, and finally execute the sql. If the dataSource name is not specified, the original logic will be followed.
  • The data source name parameter is stored in the first line of the script through an identifier like: %data_source_name, which is similar to the parsing and storage mechanism of variable parameters.


Things to Consider & Note:

  •  Do you need to consider the compatibility of the original parameter method?

Changes


Modification Detail
1
Modification of maven module


2Modification of HTTP interface
3Modification of the client interface
4Modification of database table structure
5Modification of configuration item
6Modification Error code 
7Modifications for Third Party Dependencies

Compatibility, Deprecation, and Migration Plan

  • What impact (if any) will there be on existing users?
  • If we are changing behavior, how will we phase out the older behavior?
  • If we require special migration tools, describe them here.
  • When will we remove the existing behavior?