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

获取数据库实例

使用get命令获取数据库实例列表、详情或者查询数据库数据。

命令结构

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

参数

简写

是否必选

说明

instance-id

数据库实例 id,不填写时表示获取数据库实例列表,填写时表示获取数据库实例详情。

--data

-d

是否查询数据库数据,需要和database-id参数一起使用。

--limit

-l

限制量,默认为10,取值范围[0,1000],只有在--data参数使用时才生效。

--offset

-o

偏移量,默认为0,取值范围[0,100000000],只有在--data参数使用时才生效。

--query

-q

查询条件,格式为{column}::{operator}::{number}。`::`分割一个表达式中的列名、操作符和值。不同类型支持的操作符如下:String支持like(模糊搜索)、equal(精确搜索)、notlike(不包含)、notequal(不等于),Double支持gt(大于)、lt(小于),Long支持gte(大于等于)、lte(小于等于)、gt(大于)、lt(小于)。只有在--data参数使用时才生效。

例如查询下图数据库中第2列,数值大于1数据。-q Ace2_H34::gt::1

--sort-key

-k

排序字段,只有在--data参数使用时才生效。

--sort-dir

-i

排序方向,升序或降序,即ASC 和DESC,默认DESC,只有在--data参数使用时才生效。

--columns

-c

当某个数据库实例列数非常多时,查看数据时会由于机器显示界面限制导致换行难以查看,添加此参数可以只显示想要查看数据的列名,多个列名用分号隔开(;),只有在--data参数使用时才生效。

--project

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

命令示例

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

  • 获取数据库实例列表
    health get db instance
    # 返回结果如下
    Database  ID   Template   Source Project  Creator  Number of Records  Created  Modified 
    demo-01   xxx  template1  project-01      EIHealth 1234               xxx      xxx 
    demo-02   xxx  template1  project-02      EIHealth 347                xxx      xxx
  • 获取模板详情
    health get db instance 12345
    # 返回结果如下
    {
      "id": "xxxx",
      "name": "job-1622803262953",
      "description": "database instance for drug screening, do not delete",
      "template": {
        "id": "xxxx",
        "name": "job-1622803262953-d69d2162",
        "description": "template for drug screening, study name is study-rbqr5mvgrqm086kz, job name is job-1622803262953",
        "source_project_name": "drug-screening-demo-01",
        "source_project_id": "xxxx",
        "source_template_id": "",
        "creator": "ei_eihealth_02",
        "columns": [
          {
            "name": "drugs",
            "type": "String",
            "description": "The name of the drug",
            "nullable": false,
            "primary": true,
            "searchable": true,
            "unique": true,
            "tips": ""
          },
          {
            "name": "Nsp10_6zct_pure",
            "type": "Double",
            "description": "The binding energy between the ligand and receptor",
            "nullable": true,
            "primary": false,
            "searchable": false,
            "unique": false,
            "tips": ""
          },
          {
            "name": "NSP13_pure",
            "type": "Double",
            "description": "The binding energy between the ligand and receptor",
            "nullable": true,
            "primary": false,
            "searchable": false,
            "unique": false,
            "tips": ""
          },
          {
            "name": "Average",
            "type": "Double",
            "description": "The average of the binding energy",
            "nullable": false,
            "primary": false,
            "searchable": false,
            "unique": false,
            "tips": ""
          },
          {
            "name": "Standard_Deviation",
            "type": "Double",
            "description": "The standard deviation of the binding energy",
            "nullable": true,
            "primary": false,
            "searchable": false,
            "unique": false,
            "tips": ""
          }
        ],
        "create_time": "2021-06-04T10:41:32Z",
        "primary_key": "drugs",
        "is_prefab": false
      },
      "creator": "ei_eihealth_02",
      "create_time": "2021-06-04T10:43:25Z",
      "update_time": "2021-06-04T10:43:26Z",
      "data_count": 2,
      "source_project_name": "drug-screening-demo-01",
      "source_project_id": "xxxx",
      "source_id": "",
      "is_prefab": false
    }
  • 查询数据
    health get db instance 12345 --data --limit 2
    # 返回结果如下
    drugs                 nsp3   mpro  average  standard_deviation    _row_num
    Pyridoxal-phosphate   -5.1   -4.7  -4.9     0.2                   8496
    Tetrahydrofolic-acid  -7.8   -8.3  -8.05    0.25                  8495
  • 按列查询数据
    health get db instance 12345 --data --limit 2 --columns drugs;nsp3;mpro
    # 返回结果如下
    drugs                 nsp3   mpro   _row_num
    Pyridoxal-phosphate   -5.1   -4.7   8496  
    Tetrahydrofolic-acid  -7.8   -8.3   8495
分享:

    相关文档

    相关产品