Skip to content

Doris对DataGrip的元数据的兼容 #4331

@Astralidea

Description

@Astralidea

Is your feature request related to a problem? Please describe.
DataGrip是JetBrain用来操作各种数据库,例如Mysql客户端的一个图形化软件。
这个软件在连Mysql的时候能显示出来有哪些数据库,有哪些表,如图:
image

Describe the solution you'd like
但是在连Doris的时候则显示不出来,这边儿希望达到类似的效果。

Describe alternatives you've considered
另一种方案就是让DataGrip支持Doris这种数据库,DataGrip现在都支持ClickHouse。
但是这个方案个人觉得应该不太好推。

Additional context
这边儿简单的分析了一下原因。DataGrip在探查数据库的时候会执行这样一句SQL。
select schema_name as name
from information_schema.schemata
order by if(schema() = schema_name, 1, 2),
schema_name
而Doris仅支持select database(),而不支持select schema()。
然后我查阅了一下Mysql的手册:
https://dev.mysql.com/doc/refman/5.6/en/information-functions.html#function_schema
发现其实database()和schema()其实是等价的。

这块看了下代码写了一个简单的PR。并且本地测试了展开数据库没问题,但是展开不了表。
但是如果想看具体database里有什么表的话,DataGrip似乎先会查询这样一个SQL。
select
collation_name,
character_set_name,
is_default collate utf8_general_ci = 'Yes' as is_default
from information_schema.collations
这样的SQL在Mysql能work,但是在Doris里不能跑,主要的原因应该是collate,所以后面的操作不能执行。
想问一下Doris官方觉得是否应该支持这样的SQL呢?看起来不像是一个简单的改动。
如果是的话,后面我会看看怎么搞一个PR来支持DataGrip展示表。

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mysql-compatibilityIssues or PRs related to the mysql compatibilityarea/sql/compatibilityIssues or PRs related to the SQL compatibililty

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions