更新时间:2023-02-27 GMT+08:00
分享

获取数据库模板

使用get命令获取数据库模板列表、详情或者示例yaml文件。

命令结构

health get database template <template-id> [flags] 或者 health get db template <template-id> [flags]
表1 参数说明

参数

简写

是否必选

说明

template-id

template id,不填写时表示获取template列表,填写时表示获取template详情。

--sample

-s

显示示例yaml文件内容,以yaml格式打印到控制台,需要直接获取示例文件可使用Linux输出流重定向。

--project

指定项目名。未填写则使用配置文件中的项目名。

命令示例

本节以Windows为例介绍eihealth-toolkit的使用过程,Linux和macOS环境使用方法基本相同,可参考。

  • 获取模板列表
    health get db template
    # 返回结果如下
    Template         ID   Source Project    Creator      Created             
    shennongProject  xxx  drug-screening    EIHealth     2021-02-01 11:11:27
    ligandAnnotation xxx  drug-screening    EIHealth     2021-02-01 11:11:27
  • 获取模板详情
    health get db template xxxx
    # 返回结果如下
    {
      "id": "xxxx",
      "name": "ligandAnnotation",
      "description": "commom template for ligand annotation",
      "source_project_name": "drug-screening-demo-01",
      "source_project_id": "xxxx",
      "source_template_id": "",
      "creator": "EIHealth",
      "columns": [
        {
          "name": "DrugBankID",
          "type": "String",
          "description": "The ID of the drug in DrugBank",
          "nullable": false,
          "primary": true,
          "searchable": true,
          "unique": true,
          "tips": ""
        },
        {
          "name": "GenericName",
          "type": "String",
          "description": "The generic name of the drug",
          "nullable": false,
          "primary": false,
          "searchable": true,
          "unique": false,
          "tips": ""
        },
        {
          "name": "GroupOfDrug",
          "type": "String",
          "description": "The group of the drug",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        },
        {
          "name": "Formula",
          "type": "String",
          "description": "The chemical formula of the drug",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        },
        {
          "name": "SMILES",
          "type": "String",
          "description": "The smiles of the drug",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        },
        {
          "name": "Target",
          "type": "String",
          "description": "The target of the drug",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        },
        {
          "name": "Description",
          "type": "String",
          "description": "The desciption of the drug",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        },
        {
          "name": "FractionCsp3",
          "type": "Double",
          "description": "The ratio of sp3 hybridized carbons over the total carbon count of the drug",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        },
        {
          "name": "MW",
          "type": "Double",
          "description": "The MW of the drug",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        },
        {
          "name": "XLOGP3",
          "type": "Double",
          "description": "The XLOGP3 of the drug",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        },
        {
          "name": "RotatableBondNum",
          "type": "Double",
          "description": "The number of rotatable bonds for flexibility",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        },
        {
          "name": "TPSA",
          "type": "Double",
          "description": "TPSA for polarity",
          "nullable": false,
          "primary": false,
          "searchable": false,
          "unique": false,
          "tips": ""
        }
      ],
      "create_time": "2021-06-01T12:49:15Z",
      "primary_key": "DrugBankID",
      "is_prefab": true
    }
  • 获取模板示例文件
    health get db template --sample
    # 返回结果如下
    database:
      name: demo                          # 模板名称,必填,长度范围[3,32],只能包含字母、数字、中划线、下划线,必须以字母开头
      description: This is demo template  # 模板描述,非必填,最大长度允许1024
      columns:                            # 数据库列定义列表,必填,最多不能超过100个
        - name: id                        # 列名,必填,长度[1,55],必须以字母开头,只能包含字母、数字、下划线
          description: identifier         # 列描述,非必填,最大长度1024
          type: Long                      # 列类型,必填,支持Long,String,Double三种类型
          nullable: false                 # 列是否允许为空,必填
          unique: false                   # 列是否增加唯一约束,必填
          primary: true                   # 列是否作为主键,必填,若有多个列设为true,则多个列组成复合主键
          searchable: true                # 列是否可查询,必填
          tips: uuid                      # 列的查询提示,非必填, 若该列为可查询列,可提供查询提示
        - name: user_name
          description: user name
          type: String
          nullable: false
          unique: false
          primary: false
          searchable: true
          tips: string
        - name: score
          description: score
         type: Double
          nullable: false
          unique: false
          primary: false
          searchable: true
          tips: string
  • 将示例文件存储到当前所在路径的app.yaml文件中
    health get db template --sample > app.yaml

相关文档