Skip to content

关于SCQL run in kuscia中使用kusciadatamesh的一些疑问 #436

@Handikang

Description

@Handikang

Issue Type

Others

Have you searched for existing issues?

Yes

Link to Relevant Documentation

No response

Question Details

kuscua版本:0.8.0b0
scql版本:0.9.2b1

按照官方提供的https://www.secretflow.org.cn/zh-CN/docs/kuscia/v0.9.0b0/tutorial/run_scql_on_kuscia_cn
和https://www.secretflow.org.cn/zh-CN/docs/scql/0.9.2b1/topics/deployment/run-scql-on-kuscia
两个连接我将scql部署在了kuscia中,目前仅是单节点自查单表的sql
下面是对应的操作以及结果:
# 在容器内执行示例
export CTR_CERTS_ROOT=/home/kuscia/var/certs
curl -k -X POST 'https://localhost:8082/api/v1/domaindatasource/create' \
 --header "Token: $(cat ${CTR_CERTS_ROOT}/token)" \
 --header 'Content-Type: application/json' \
 --cert ${CTR_CERTS_ROOT}/kusciaapi-server.crt \
 --key ${CTR_CERTS_ROOT}/kusciaapi-server.key \
 --cacert ${CTR_CERTS_ROOT}/ca.crt \
 -d '{
  "domain_id": "com2023011620072311738",
  "datasource_id":"scql-demo-local-datasource",
  "type":"mysql",
  "name": "DemoDataSource",
  "info": {
      "database": {
          "endpoint": "10x.28.5.09:3306",
          "user": "root",
          "password": "123456",
          "database":"alice"
      }
  },
  "access_directly": true
}'


export CTR_CERTS_ROOT=/home/kuscia/var/certs
curl -k -X POST 'https://localhost:8082/api/v1/domaindata/create' \
 --header "Token: $(cat ${CTR_CERTS_ROOT}/token)" \
 --header 'Content-Type: application/json' \
 --cert ${CTR_CERTS_ROOT}/kusciaapi-server.crt \
 --key ${CTR_CERTS_ROOT}/kusciaapi-server.key \
 --cacert ${CTR_CERTS_ROOT}/ca.crt \
 -d '{
  "domain_id": "com2023011620072311738",
  "domaindata_id": "scqltable2",
  "datasource_id": "scql-demo-local-datasource",
  "name": "alice001",
  "type": "table",
  "relative_uri": "alice.user_credit",
  "columns": [
    {
      "name": "ID",
      "type": "str"
    },
    {
      "name": "credit_rank",
      "type": "int"
    },
    {
      "name": "income",
      "type": "int"
    },
    {
      "name": "age",
      "type": "int"
    }
  ]
}'


curl -X POST http://127.0.0.1:80/intra/project/create \
--header "host: scql-broker-intra.com2023011620072311738.svc" \
--header "kuscia-source: com2023011620072311738" \
-d '{
    "project_id":"demo2",
    "name":"demo2",
    "conf":{
        "spu_runtime_cfg":{
        "protocol":"SEMI2K",
        "field":"FM64"
        }
    },
   "description":"this is a project"
}'


curl -X POST http://127.0.0.1:80/intra/table/create \
--header "host: scql-broker-intra.com2023011620072311738.svc" \
--header "kuscia-source: com2023011620072311738" \
-H "Content-Type: application/json" \
-d '{
    "project_id": "demo2",
    "table_name": "ta",
    "ref_table": "scqltable2",
    "db_type": "mysql",
    "columns": [
        {"name":"ID","dtype":"string"},
        {"name":"credit_rank","dtype":"int"},
        {"name":"income","dtype":"int"},
        {"name":"age","dtype":"int"}
    ]
}'


curl -X POST http://127.0.0.1:80/intra/ccl/grant \
--header "host: scql-broker-intra.com2023011620072311738.svc" \
--header "kuscia-source: com2023011620072311738" \
-H "Content-Type: application/json" \
-d '{
    "project_id": "demo2",
    "column_control_list":[
    {"col":{"column_name":"ID","table_name":"ta"},"party_code":"com2023011620072311738","constraint":1},
    {"col":{"column_name":"age","table_name":"ta"},"party_code":"com2023011620072311738","constraint":1},
    {"col":{"column_name":"income","table_name":"ta"},"party_code":"com2023011620072311738","constraint":1},
    {"col":{"column_name":"credit_rank","table_name":"ta"},"party_code":"com2023011620072311738","constraint":1}
    ]
}'


curl -X POST http://127.0.0.1:80/intra/query \
--header "host: scql-broker-intra.com2023011620072311738.svc" \
--header "kuscia-source: com2023011620072311738" \
-H "Content-Type: application/json" \
-d '{
    "project_id": "demo2",
    "query":"SELECT * from ta;"
}'


下面是对应结果
curl -X POST http://127.0.0.1:80/intra/query \
--header "host: scql-broker-intra.com2023011620072311738.svc" \
--header "kuscia-source: com2023011620072311738" \
-H "Content-Type: application/json" \
-d '{
    "project_id": "demo2",
    "query":"SELECT * from ta;"
}'
{"status":{"code":320, "message":"RunExecutionPlan run jobs(fb626e58-cf02-11ef-a085-d2a244c564e6) failed, catch std::exception=[engine/datasource/odbc_adaptor.cc:44] catch unexpected Poco::Data::DataException: MySQL: [MySQL]: [Comment]: mysql_stmt_prepare error\t[mysql_stmt_error]: Table 'alice.scqltable2' doesn't exist\t[mysql_stmt_errno]: 1146\t[mysql_stmt_sqlstate]: 42S02\t[statemnt]: select scqltable2.ID,scqltable2.age,scqltable2.credit_rank,scqltable2.income from scqltable2;", "details":[]}, "result":null}



我的疑问是,通过kusciadatamesh路由到的数据源为什么没能找到ta对应的表alice.user_credit,而是通过kuscia中的domaindata去查

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions