secretflow / scql

SCQL (Secure Collaborative Query Language) is a system that allows multiple distrusting parties to run joint analysis without revealing their private data.
https://www.secretflow.org.cn/docs/scql/en/
Apache License 2.0
125 stars 45 forks source link

关于使用ArrowSql作为数据源的问题 #241

Open coffee1110 opened 8 months ago

coffee1110 commented 8 months ago

您好,我想请教下,使用中心化部署的集群,scqlEngine配置arrowSql,但是在执行查询的时候出现如下异常 2024-01-26 09:49:15.725 [error] [engine_service_impl.cc:RunPlanSync:364] [scqlengine] RunExecutionPlan run jobs(2ab24365-bc30-11ee-bb39-0242ac1a0002) failed, catch std::exception=[engine/datasource/arrow_sql_adaptor.cc:124] IOError: Flight returned unauthenticated error, with message: . Detail: Unauthenticated 其中sqlEngine的gflags.conf的配置如下 `--listen_port=8080 --datasource_router=embed --enable_driver_authorization=false

开启tls

--server_enable_ssl=true --driver_enable_ssl_as_client=true --peer_engine_enable_ssl_as_client=true --server_ssl_certificate=/home/admin/engine/conf/cert.pem --server_ssl_private_key=/home/admin/engine/conf/key.pem --embed_router_conf={"datasources":[{"id":"ds001","name":"arrowsql db","kind":"ARROWSQL","connection_str":"grpc+tcp://192.168.209.131:32010"}],"rules":[{"db":"","table":"","datasource_id":"ds001"}]}

party authentication flags

--enable_self_auth=true --enable_peer_auth=true --private_key_pem_path=/home/admin/engine/conf/ed25519key.pem --authorized_profile_path=/home/admin/engine/conf/authorized_profile.json` 是不是需要配置arrowSql的用户名密码,如果需要的话应该如何配置用户名密码呢

tyrone-yu commented 8 months ago

SCQL 连接 ARROWSQL server 目前没有实现 authorize 功能,在 SCQL 实现 arrow sql 的时候设想 SCQL 的 engine 应当和 ARROWSQL server 部署在一起,ARROWSQL server 只能由 SCQL engine 访问,没有鉴权的需求。 能说明一下你们现在的具体需求或者你们的部署方案么?有比较强烈的需求使用账密鉴权的需求么?

coffee1110 commented 8 months ago

目前是中心化部署,目前是看到SCQL是支持arrowsql的,因此用了一个现有的dremio进行测试,dremio是需要用户名密码的,出现上述问题,因此先请教下能否配置鉴权。 如果按照这边所说的,是否应该自己实现一个无需鉴权的arrowsql的服务端程序,部署在engine同一台服务器,是不是只要实现doAction执行查询的方法呢,还是arrow flight sql的方法均需要实现呢?

tyrone-yu commented 8 months ago

我们验证的时候 server 是 java 实现的 因为 scql 只需要从 datasource 获取数据不需要写入数据。所以实现的时候直接继承 FlightSqlProducer 然后实现必要的 getFlightInfoStatement getStreamStatement 函数即可

coffee1110 commented 8 months ago

请问下,目前使用的arrow-flight-sql的版本有要求吗

tyrone-yu commented 8 months ago

我们现在使用的是 arrow 10.0.0 版本,和这个版本兼容的都是可以的

另外问下,你们准备通过 arrow sql 连接什么数据库啊?

coffee1110 commented 8 months ago

目前想测试连接的是es和oracle。如果按照上述服务端要求,实现对应的方法,在根据sql查询的时候,获取es或者oracle的查询结果,这样是否可行呢

tyrone-yu commented 8 months ago

oracle 应该是可以的,es 目前还适配不了 你们那边对 es 有强诉求么?

coffee1110 commented 8 months ago

目前我们也处于探索方案可行性上面,如果可以适配,肯定是比较好的。 那现在arrowSql的方案,还有几个问题,想请教下老师 1.是否主流关系型数据库都可以适配呢(比如sqlserver)? 2.国产数据库目前有可以适配的吗?

tyrone-yu commented 8 months ago

arrow sql 是用来从数据库获取数据的。 支持对应数据库还有一部分的工作,就是看对应的数据库的语法我们是否已经支持了。比如看这里 https://github.com/secretflow/scql/blob/main/pkg/parser/format/format_dialect.go 这里就是我们对方言进行支持的一部分工作。 所以具体情况还要看对应数据库使用的语法,如果有需要的可以对应扩展相应的方言支持

tyrone-yu commented 8 months ago

看了下 elastic search 新的版本也支持 sql 语法了,那应该也可以尝试通过 arrowSql 的方式进行连接

coffee1110 commented 8 months ago

好的,谢谢,我想请问下有server端的示例吗

tyrone-yu commented 8 months ago

目前没有连接 ES 和 Oracle 的示例