hhyo / Archery

SQL 审核查询平台
https://archerydms.com
Apache License 2.0
6k stars 1.68k forks source link

SQL查询校验权限报错:无法校验查询语句权限,请联系管理员,错误信息:'Schema' #1926

Open sona-yuan opened 1 year ago

sona-yuan commented 1 year ago

重现步骤

SELECT store_code FROM (select '3230177' as store_code union select '3230178' as store_code union select '3230180' as store_code union select '3230317' as store_code) as tmp_store where store_code not in (select store_code FROM order_refund_store_config)

预期外的结果

无法校验查询语句权限,请联系管理员,错误信息:'Schema'

日志文本

[2022-10-21 11:50:34,431][MainThread:140620658501440][task_id:default][query_privileges.py:85][ERROR]- 无法校验查询语句权限,oms-tidb,select  store_code from (select '3230177' as store_code union select '3230178' as store_code union select '3230180' as store_code union select '3230181' as store_code) as t,Traceback (most recent call last):
  File "/opt/archery/sql/query_privileges.py", line 69, in query_priv_check
    table_ref = _table_ref(sql_content, instance, db_name)
  File "/opt/archery/sql/query_privileges.py", line 410, in _table_ref
    return engine.get_table_ref(json.loads(query_tree), db_name=db_name)
  File "/opt/archery/sql/engines/goinception.py", line 213, in get_table_ref
    table_ref.extend([
  File "/opt/archery/sql/engines/goinception.py", line 215, in <listcomp>
    "schema": snode['Source']['Schema']['O'] or db_name,
KeyError: 'Schema'

版本

1.8.5

部署方式

K8S

是否还有其他可以辅助定位问题的信息?比如数据库版本等

No response

Xuejicha0 commented 1 year ago

刚从1.7.7 升级到 1.9.1 同样遇到了这个问题,怎么解决呢