1. 数据连接

1.1. 数据连接说明

进行数据分析的第一步即获取数据,获取数据的第一步即定义数据连接。数据连接是衡石系统连接用户数据库的途径。

1.1.1. 数据连接的类型

衡石系统支持多种数据源的多种版本,详情见数据源版本支持

1.1.2. 数据连接的结构说明

字段 类型 描述
id LONG 权限条目的 id
title STRING 权限条目的标题
accessCount INTEGER 访问次数
tenantId LONG 数据连接所属的租户
options OBJECT 数据连接的配置信息
options.username STRING 连接数据源的用户名
options.password STRING 连接数据源的用户密码
options.host STRING 数据源的机器名或者机器IP
options.port INTEGER 数据源的端口号
options.encoding STRING 连接数据源的编码
options.type STRING 数据源的类型
options.category STRING 数据源所属的分类
options.database STRING 数据库的名字
options.maxConnNum INTEGER 最大连接数
options.outputAble BOOL 是否可以用于数据集成的输出
options.fileOutputPath 数组 可用于上传文件的指定路径

Mysql 数据源说明

Category: Database

Type: mysql

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 3306
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"encoding": {
    "name": "编码",
    "optionList": [
        "UTF-8",
        "GBK",
        "Big5",
        "EUC_CN",
        "Cp1252",
        "UnicodeBig"
    ]
},
"supportWrite": true,
"mysql8OnAzure": {
    "name": "使用Azure MySQL 8.0.15",
    "required": false,
    "message": "由于Azure MySQL 8.0.15存在版本号传递错误的bug(<a href=\"https://docs.microsoft.com/zh-cn/azure/mysql/concepts-limits\" target=\"_blank\">官方说明</a>),若当前您需要连接Azure上的该版本Mysql,请将该参数设置为'开启'。",
    "optionList": [
        "false",
        "true"
    ]
}

Tidb 数据源说明

Category: NoSQL / NewSQL

Type: tidb

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 4000
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"encoding": {
    "name": "编码",
    "optionList": [
        "UTF-8",
        "GBK",
        "Big5",
        "EUC_CN",
        "Cp1252",
        "UnicodeBig"
    ]
}

PostgreSQL 数据源说明

Category: Database

Type: postgresql

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 5432
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"encoding": {
    "name": "编码",
    "optionList": [
        "UTF-8",
        "GBK",
        "Big5",
        "EUC_CN",
        "Cp1252",
        "UnicodeBig"
    ]
},
"supportWrite": true

Greenplum 数据源说明

Category: Database

Type: greenplum

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 5432
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"encoding": {
    "name": "编码",
    "optionList": [
        "UTF-8",
        "GBK",
        "Big5",
        "EUC_CN",
        "Cp1252",
        "UnicodeBig"
    ]
},
"supportWrite": true

Oracle 数据源说明

Category: Database

Type: oracle

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 1521
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
}

DB2 数据源说明

Category: Database

Type: db2

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 50000
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"schema": {
    "name": "模式",
    "required": false
}

Hive 数据源说明

Category: SQL on Hadoop

Type: hive

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 10000
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true,
    "dlefault": "default",
    "default": "default"
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"hiveExecutionEngine": {
    "name": "hive 执行引擎",
    "required": true,
    "optionList": [
        "mr",
        "tez",
        "spark"
    ]
},
"hadoopAuthentication": {
    "name": "hadoop 认证方式",
    "required": true,
    "optionList": [
        "simple",
        "kerberos",
        "tbds"
    ]
},
"kerberosRealm": {
    "name": "realm",
    "required": true
},
"kerberosKdc": {
    "name": "kdc",
    "required": true
},
"serverPrincipal": {
    "name": "server principal",
    "required": true
}

Spark SQL 数据源说明

Category: SQL on Hadoop

Type: spark_sql

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 10001
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true,
    "dlefault": "default",
    "default": "default"
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"encoding": {
    "name": "编码",
    "optionList": [
        "UTF-8",
        "GBK",
        "Big5",
        "EUC_CN",
        "Cp1252",
        "UnicodeBig"
    ]
}

微软 SQL Server 数据源说明

Category: Database

Type: sqlserver

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 1433
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
}

Cloudera Impala 数据源说明

Category: SQL on Hadoop

Type: cloudera_impala

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 21050
},
"username": {
    "name": "用户名",
    "required": false
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true,
    "dlefault": "default",
    "default": "default"
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"encoding": {
    "name": "编码",
    "optionList": [
        "UTF-8",
        "GBK",
        "Big5",
        "EUC_CN",
        "Cp1252",
        "UnicodeBig"
    ]
}

MongoDB 数据源说明

Category: NoSQL / NewSQL

Type: mongodb

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 3307
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"schema": {
    "name": "认证数据库",
    "required": false
}

麒麟企业版 数据源说明

Category: SQL on Hadoop

Type: kap

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 7070
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"ssl": {
    "name": "ssl",
    "required": true,
    "optionList": [
        "false",
        "true"
    ]
}

Amazon Redshift 数据源说明

Category: Cloud

Type: amazon_redshift

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 5439
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
},
"encoding": {
    "name": "编码",
    "optionList": [
        "UTF-8",
        "GBK",
        "Big5",
        "EUC_CN",
        "Cp1252",
        "UnicodeBig"
    ]
},
"ssl": {
    "name": "ssl",
    "required": true,
    "optionList": [
        "false",
        "true"
    ]
},
"supportWrite": true

Alibaba Maxcompute 数据源说明

Category: Cloud

Type: alibaba_maxcompute

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 443
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
}

Presto 数据源说明

Category: SQL on Hadoop

Type: presto

连接属性说明:

"host": {
    "name": "机器地址",
    "required": true
},
"port": {
    "name": "端口",
    "required": true,
    "default": 8080
},
"username": {
    "name": "用户名",
    "required": true
},
"password": {
    "name": "密码"
},
"catalog": {
    "name": "Catalog",
    "required": true
},
"database": {
    "name": "数据库",
    "required": true
},
"maxConnNum": {
    "name": "最大连接数",
    "required": true,
    "default": 10
}

1.1.3. 数据源内的数据表结构说明

字段 类型 描述
pathType STRING 该节点的类型,path 是路径,table 是表
name STRING 节点名
tableType STRING table 是表, view 是视图
children 数组 下游节点的数组,每个节点的描述结构和该节点相同
priority STRING 权限条目的权限级别, 详情见priority值说明
hasAuth BOOL 标记当前节点上是否设置过链接权限
ignoreNewlyCreatedTable BOOL 是否忽略后续新增的表,用于批量同步任务配置
inputStrategy STRING 当前表的同步策略,用于批量同步任务配置,详见数据集成的“输入节点的输入策略”部分
incrementalField STRING 数组 当前表的增量字段,仅inputStrategy是增量时生效
keyFields STRING 数组 当前表同步时的键字段字段,仅inputStrategy是增量时生效
includeStatus STRING 节点包含状态,见包含状态
isDirExpand BOOL 当前节点是否处于展开状态
包含状态
说明
ALL 目录子项目全部被包含,对于table节点,ALL表示包含本节点
NONE 目录子项目没有一个被包含,对于table节点,NONE表示不包含本节点
SOME 目录子项目至少有一个被包含,但是不是全部包含,对于table节点,SOME不适用

预览数据源中数据表的结构

预览

字段 类型 描述
where OBJECT 数组 过滤条件
customSql STRING 自定义查询语句
table STRING 要预览的表名
path STRING 数组 要预览的表所在的路径数组

1.2. 接口说明

1.2.1. 验证数据连接

请求URL

POST /api/v1/connections/verify

请求参数

URL 参数

Request Body 参数

参照上述各数据源的连接属性说明

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
msg OBJECT 请求成功返回 success

接口示例1

  1. 请求 POST /api/v1/connections/verify
    {
     "type": "postgresql",
     "category": "Database",
     "title": "测试连接",
     "host": "***",
     "port": ***,
     "username": "***",
     "password": "***",
     "database": "***",
     "maxConnNum": 10,
     "encoding": "UTF-8"
    }
    
    返回
    {"version":"3.2-SNAPSHOT@7b60496#e798247","code":0,"msg":"success"}
    

1.2.2. 新增数据连接

请求URL

POST /api/v1/connections

请求参数

Request Body 参数

参照上述各数据源的连接属性说明

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 数据连接结构说明

接口示例1 新建 Postgres 数据连接,而且此数据连接可以用于数据集成的输出,并且指定了文件上传路径

  1. 请求 POST /api/v1/connections
    {
     "title": "apitestcoo",
     "type": "postgresql",
     "category": "Database",
     "host": "192.168.2.250",
     "port": 5410,
     "username": "postgres",
     "password": "postgres",
     "database": "postgres",
     "maxConnNum": 10,
     "encoding": "UTF-8",
     "outputAble": true,
     "fileOutputPath":["test"]
    }
    
    返回
    {
     "version": "3.2-SNAPSHOT@7b60496#e798247",
     "code": 0,
     "msg": "success",
     "data": {
         "id": 3261,
         "options": {
             "username": "***",
             "password": "***",
             "host": "***",
             "port": ***,
             "encoding": "UTF-8",
             "type": "postgresql",
             "database": "***",
             "maxConnNum": 10,
             "config": {},
             "category": "Database",
             "protocol": "http",
             "outputAble": true
         },
         "createdBy": 6,
         "createdAt": "2020-06-03 15:20:02",
         "updatedBy": 6,
         "updatedAt": "2020-06-03 15:20:02",
         "visible": true,
         "title": "apitestcoo"
     }
    }
    

    1.2.3. 分页查询数据连接

请求URL

GET /api/v1/connections

请求参数

字段 类型 是否必须 说明
orderBy STRING 排序字段
connectionType STRING 数据连接的类型,见上文各类型说明中的 Type
auth BOOL 只列出我被授权的
createdByCurrent BOOL 只列出我创建的

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 数据连接结构说明

接口示例1 分页查询数据连接

  1. 请求 GET /api/v1/connections?createdByCurrent=true 返回
    {
     "version": "3.2-SNAPSHOT@7b60496#e798247",
     "code": 0,
     "msg": "success",
     "data": [
         {
             "id": 3261,
             "options": {
                 "username": "***",
                 "password": "***",
                 "host": "***",
                 "port": ***,
                 "encoding": "UTF-8",
                 "type": "postgresql",
                 "database": "***",
                 "maxConnNum": 10,
                 "config": {},
                 "category": "Database",
                 "protocol": "http",
                 "outputAble": true
             },
             "createdBy": 6,
             "createdAt": "2020-06-03 15:20:02",
             "updatedBy": 6,
             "updatedAt": "2020-06-03 15:20:02",
             "visible": true,
             "title": "apitestcoo"
         }
     ]
    }
    

    1.2.4. 根据ID查询数据连接

请求URL

GET /api/v1/connections/{connectionId}

请求参数

字段 类型 说明
connectionId INTEGER 数据连接的 id
queryFunctions BOOL 返回结果是否包含数据连接支持的functions信息

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 数据连接结构说明

接口示例1 查询 id 为 1 的数据连接

  1. 请求 GET /api/v1/connections/1 返回
    {
     "version": "3.2-SNAPSHOT@7b60496#e798247",
     "code": 0,
     "msg": "success",
     "data": {
         "id": 3261,
         "options": {
             "username": "***",
             "password": "***",
             "host": "***",
             "port": ***,
             "encoding": "UTF-8",
             "type": "postgresql",
             "database": "***",
             "maxConnNum": 10,
             "config": {},
             "category": "Database",
             "protocol": "http",
             "outputAble": true
         },
         "createdBy": 6,
         "createdAt": "2020-06-03 15:20:02",
         "updatedBy": 6,
         "updatedAt": "2020-06-03 15:20:02",
         "visible": true,
         "title": "apitestcoo"
     }
    }
    

    1.2.5. 更新已有数据连接的信息

请求URL

PUT /api/v1/connections/{connectionId}

请求参数

字段 类型 说明
connectionId INTEGER 数据连接的 id
Request Body 参数

参照上述各数据源的连接属性说明

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 数据连接结构说明

接口示例1 更新 id 为 1 的数据连接,不允许上传文件到该数据连接

  1. 请求 PUT /api/v1/connections/1
    {
     "title": "apitestcoo",
     "type": "postgresql",
     "category": "Database",
     "host": "192.168.2.250",
     "port": 5410,
     "username": "postgres",
     "password": "postgres",
     "database": "postgres",
     "maxConnNum": "10",
     "encoding": "UTF-8",
     "outputAble": true,
     "fileOutputPath": null
    }
    
    返回
    {
     "version": "3.2-SNAPSHOT@7b60496#e798247",
     "code": 0,
     "msg": "success",
     "data": {
         "id": 3261,
         "options": {
             "username": "***",
             "password": "***",
             "host": "***",
             "port": ***,
             "encoding": "UTF-8",
             "type": "postgresql",
             "database": "***",
             "maxConnNum": 10,
             "config": {},
             "category": "Database",
             "protocol": "http",
             "outputAble": true
         },
         "createdBy": 6,
         "createdAt": "2020-06-03 15:20:02",
         "updatedBy": 6,
         "updatedAt": "2020-06-03 15:20:02",
         "visible": true,
         "title": "apitestcoo"
     }
    }
    

    1.2.6. 删除已有数据连接

请求URL

DELETE /api/v1/connections/{connectionId}

请求参数

字段 类型 说明
connectionId INTEGER 数据连接的 id

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
msg STRING 成功返回 success

1.2.7. 根据id查询所有路径的所有table

请求URL

GET /api/v1/connections/{connectionId}/path-tables

请求参数

字段 类型 是否必须 说明
connectionId INTEGER 数据连接的 id
pathOnly BOOL 数据连接的 id
targetType STRING user 表示按用户查看;organization 表示按组织查看
targetId INTEGER 指定的访问者用户或者组织的 id

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 数据源内的数据表结构说明

接口示例1 更新 id 为 1 的数据连接,不允许上传文件到该数据连接

  1. 请求 GET /api/v1/connections/1/path-tables 返回
    {
     "version": "3.2-SNAPSHOT@6929f52#e798247",
     "code": 0,
     "msg": "success",
     "data": [
         {
             "pathType": "path",
             "name": "default",
             "children": [
                 {
                     "pathType": "table",
                     "name": "a_ivt_audit_heis",
                     "tableType": "TABLE"
                 }
             ]
         },
         {
             "pathType": "path",
             "name": "test",
             "children": [
                 {
                     "pathType": "table",
                     "name": "mytest",
                     "tableType": "TABLE"
                 }
             ]
         }
     ]
    }
    

1.2.8. 查询table中的数据

请求URL

POST /api/v1/connections/{connectionId}/path-table-data

请求参数

字段 类型 是否必须 说明
connectionId INTEGER 数据连接的 id
orderBy STRING 排序字段
orderType STRING 排序的方向
targetType STRING user 表示按用户查看;organization 表示按组织查看
targetId INTEGER 指定的访问者用户或者组织的 id

request body 请求体

预览数据源中数据表的结构

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT 数据集数据 datasetResultDto

接口示例1 查询数据连接中 a_ivt_audit_heis 的数据

  1. 请求 POST /api/v1/connections/1/path-table-data
    {
     "table": "a_ivt_audit_heis",
     "path": [
         "default"
     ]
    }
    
    返回
    {
     "version": "3.2-SNAPSHOT@6929f52#e798247",
     "code": 0,
     "msg": "success",
     "data": {
         "data": [
             [
                 1,
                 "北京市海淀区职工大学",
                 "4211050001",
                 "北京市",
                 "北京市",
                 ""
             ]
         ],
         "schema": [
             {
                 "fieldName": "id",
                 "originType": "integer",
                 "config": {
                     "dialectName": "ImpalaDialect"
                 },
                 "type": "number",
                 "basicType": "number",
                 "defaultAggrType": "sum",
                 "visible": true,
                 "nativeType": "BIGINT",
                 "suggestedTypes": [
                     "number",
                     "string"
                 ],
                 "detectedType": "integer"
             },
             {
                 "fieldName": "name",
                 "originType": "string",
                 "config": {},
                 "type": "string",
                 "basicType": "string",
                 "defaultAggrType": "count",
                 "visible": true,
                 "nativeType": "STRING",
                 "suggestedTypes": [
                     "string"
                 ],
                 "detectedType": "string"
             },
             {
                 "fieldName": "code",
                 "originType": "string",
                 "config": {
                     "seperator": " ",
                     "dialectName": "ImpalaDialect"
                 },
                 "type": "string",
                 "basicType": "string",
                 "defaultAggrType": "count",
                 "visible": true,
                 "nativeType": "STRING",
                 "suggestedTypes": [
                     "number",
                     "string"
                 ],
                 "detectedType": "number"
             },
             {
                 "fieldName": "department",
                 "originType": "string",
                 "config": {},
                 "type": "string",
                 "basicType": "string",
                 "defaultAggrType": "count",
                 "visible": true,
                 "nativeType": "STRING",
                 "suggestedTypes": [
                     "string"
                 ],
                 "detectedType": "string"
             },
             {
                 "fieldName": "province",
                 "originType": "string",
                 "config": {},
                 "type": "string",
                 "basicType": "string",
                 "defaultAggrType": "count",
                 "visible": true,
                 "nativeType": "STRING",
                 "suggestedTypes": [
                     "string"
                 ],
                 "detectedType": "string"
             },
             {
                 "fieldName": "comment",
                 "originType": "string",
                 "config": {},
                 "type": "string",
                 "basicType": "string",
                 "defaultAggrType": "count",
                 "visible": true,
                 "nativeType": "STRING",
                 "suggestedTypes": [
                     "string"
                 ],
                 "detectedType": "string"
             }
         ],
         "pagable": false,
         "importSwitchable": false,
         "randomable": false
     }
    }
    

1.2.9. 在连接中执行sql并返回数据

请求URL

POST /api/v1/connections/{connectionId}/path-sql-data

需要认证:是

请求参数

URL 参数
字段 类型 是否必须 说明
connectionId INTEGER 数据连接 id
Request Body 参数
字段 类型 说明
customSql STRING 要执行的sql
path STRING 数组 数据库schema路径,不同数据源类型的路径长度不同

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT sql执行返回的数据,格式参见数据集文档中关于datasetResultDto 说明

参考示例

  1. 请求
    POST http://localhost:9981/api/connections/1/path-sql-data
    
{
  "customSql":"select * from movie limit 1",
  "path":["public"]
}
  1. 返回
    {
    "version":"3.2-SNAPSHOT@@git.commit.id.abbrev@#d0f2a04",
    "data":{
     "data":[[36,"海洋"," 雅克·克鲁奥德","纪录片",104,"9","90803","皮尔斯·布鲁斯南","","2011-08-12",2009,8,12]],
     "schema":[
       {"fieldName":"id","type":"number","config":{"dialectName":"PostgresqlDialect"},"defaultAggrType":"sum","suggestedTypes":["number","string"],"originType":"integer","visible":true,"basicType":"number","detectedType":"integer","nativeType":"bigserial"},
       {"fieldName":"zh_name","type":"string","config":{},"defaultAggrType":"count","suggestedTypes":["string"],"originType":"string","visible":true,"basicType":"string","detectedType":"string","nativeType":"varchar"},
       {"fieldName":"director","type":"string","config":{},"defaultAggrType":"count","suggestedTypes":["string"],"originType":"string","visible":true,"basicType":"string","detectedType":"string","nativeType":"varchar"},
       {"fieldName":"prime_genre","type":"string","config":{},"defaultAggrType":"count","suggestedTypes":["string"],"originType":"string","visible":true,"basicType":"string","detectedType":"string","nativeType":"varchar"},
       {"fieldName":"runtime","type":"number","config":{"dialectName":"PostgresqlDialect"},"defaultAggrType":"sum","suggestedTypes":["number","string"],"originType":"integer","visible":true,"basicType":"number","detectedType":"integer","nativeType":"int8"},
       {"fieldName":"rate_num","type":"string","config":{"seperator":" ","dialectName":"PostgresqlDialect"},"defaultAggrType":"count","suggestedTypes":["number","string"],"originType":"string","visible":true,"basicType":"string","detectedType":"number","nativeType":"varchar"},
       {"fieldName":"votes","type":"string","config":{"seperator":" ","dialectName":"PostgresqlDialect"},"defaultAggrType":"count","suggestedTypes":["number","string"],"originType":"string","visible":true,"basicType":"string","detectedType":"number","nativeType":"varchar"},
       {"fieldName":"stars","type":"string","config":{},"defaultAggrType":"count","suggestedTypes":["string"],"originType":"string","visible":true,"basicType":"string","detectedType":"string","nativeType":"varchar"},
       {"fieldName":"tags","type":"string","config":{},"defaultAggrType":"count","suggestedTypes":["string"],"originType":"string","visible":true,"basicType":"string","detectedType":"string","nativeType":"varchar"},
       {"fieldName":"pubdate","type":"date","config":{"dialectName":"PostgresqlDialect"},"defaultAggrType":"year","suggestedTypes":["date","string"],"originType":"date","visible":true,"basicType":"date","detectedType":"date","nativeType":"date"},
       {"fieldName":"pubyear","type":"number","config":{"dateFormat":"yyyy","dialectName":"PostgresqlDialect"},"defaultAggrType":"sum","suggestedTypes":["number","string","date"],"originType":"integer","visible":true,"basicType":"number","detectedType":"integer","nativeType":"int8"},
       {"fieldName":"month","type":"number","config":{"dialectName":"PostgresqlDialect"},"defaultAggrType":"sum","suggestedTypes":["number","string"],"originType":"integer","visible":true,"basicType":"number","detectedType":"integer","nativeType":"int8"},
       {"fieldName":"day","type":"number","config":{"dialectName":"PostgresqlDialect"},"defaultAggrType":"sum","suggestedTypes":["number","string"],"originType":"integer","visible":true,"basicType":"number","detectedType":"integer","nativeType":"int8"}
     ],
     "importSwitchable":true
    }
    }
    

1.2.10. 获取系统支持的连接类型和相关配置

请求URL

GET /api/v1/connections/support-types

需要认证:是

请求参数

URL 参数
Request Body 参数

返回对象的格式说明

字段 类型 说明
version STRING 当前系统版本哈希值
data OBJECT数组 支持的连接类型和配置要求
data[].id STRING 连接类型唯一标识
data[].name STRING 连接类型名称
data[].logo STRING 连接类型的logo id
data[].category STRING 连接类型分组
data[].setup OBJECT 连接需要的配置项
data[].setup.host OBJECT 主机地址
data[].setup.host.name STRING 前端显示的项目名字,通用,其他配置项也有可能该字段
data[].setup.host.required BOOLEAN 配置项是否是必须的,通用,其他配置项也有可能该字段
data[].setup.port OBJECT 端口
data[].setup.port.default OBJECT 前端默认填写的值,通用,其他配置项也有可能该字段
data[].setup.username OBJECT 用户名
data[].setup.password OBJECT 密码
data[].setup.database OBJECT 连接默认用的数据库
data[].setup.maxConnNum OBJECT 连接池最大连接数
data[].setup.encoding OBJECT 连接编码
data[].setup.encoding.optionList STRING数组 前端展示的可选编码列表
data[].setup.supportWrite BOOLEAN 是否支持文件和数据集成输出

参考示例

  1. 请求
    GET http://localhost:9981/api/connections/support-types
    
  2. 返回
    {
    "version":"3.2-SNAPSHOT@@git.commit.id.abbrev@#d0f2a04",
    "data":[
     {
       "id":"mysql",
       "name":"MySQL",
       "logo":"mysql",
       "category":"Database",
       "setup":{
         "host":{
           "name":"机器地址",
           "required":true
         },
         "port":{
           "name":"端口",
           "required":true,
           "default":3306
         },
         "username":{
           "name":"用户名",
           "required":true
         },
         "password":{
           "name":"密码"
         },
         "database":{
           "name":"数据库",
           "required":true
         },
         "maxConnNum":{
           "name":"最大连接数",
           "required":true,
           "default":10
         },
         "encoding":{
           "name":"编码",
           "optionList":["UTF-8","GBK","Big5","EUC_CN","Cp1252","UnicodeBig"]
         },
         "supportWrite":true
       }
     },
     ...
    ]
    }
    

results matching ""

    No results matching ""

    设置 链接权限