Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I get the mapping of an alias in an SQL context? #150

Open
resetsix opened this issue Oct 15, 2024 · 10 comments
Open

How do I get the mapping of an alias in an SQL context? #150

resetsix opened this issue Oct 15, 2024 · 10 comments

Comments

@resetsix
Copy link
Contributor

resetsix commented Oct 15, 2024

For example, I have a SQL statement like this: Select u. from user AS u

Currently, the built-in functions of monaco-sql-languages can easily get column data from user., but not through the u. column (u is a custom user alias).

I don't have a good idea of how to implement it.

@resetsix resetsix changed the title alias How do I get the mapping of an alias in an SQL context? Oct 15, 2024
@resetsix
Copy link
Contributor Author

resetsix commented Oct 15, 2024

const completionService: CompletionService = function (
model,
position,
completionContext,
suggestions, // 语法推荐信息
entities // 当前编辑器文本的语法上下文中出现的表名、字段名等
)

Can alias information be added to the entities attribute?

@Cythia828
Copy link
Collaborator

For example, I have a SQL statement like this: Select u. from user AS u

Currently, the built-in functions of monaco-sql-languages can easily get column data from user., but not through the u. column (u is a custom user alias).

I don't have a good idea of how to implement it.

你好,感谢你的关注和使用。
关于你提的这个问题是我们后续规划中将要去实现的一个能力。目前我们已经将Table/Catalog/...等的别名信息收集到,但是这只是一个单向的关联关系,后续我们将把别名与原 Table/Catalog/... 之间建立双向关联关系,把别名也作为一个单独实体(或其他方式)收集,有此操作后,它便可拥有与原 Table/Catalog/...一样的字段信息了。
敬请期待我们的新功能~~ 当然,也欢迎你向我们提PR~~

@resetsix
Copy link
Contributor Author

@Cythia828 Thank you for your reply, this is really good news, and I look forward to the new features.

Can you roughly tell me when the new features will be released? For example, this year.

@Cythia828
Copy link
Collaborator

@Cythia828 Thank you for your reply, this is really good news, and I look forward to the new features.

Can you roughly tell me when the new features will be released? For example, this year.

你好,感谢你的关注和使用。
关于别名作为实体收集这一功能预计会在未来半年内落地,目前正在向这个结果前进。如果你这边也在做这件事或者有其他好的idea,欢迎随时向我们提PR,也欢迎动手加入我们~~~

@resetsix
Copy link
Contributor Author

你好,感谢你的关注和使用。 关于别名作为实体收集这一功能预计会在未来半年内落地,目前正在向这个结果前进。如果你这边也在做这件事或者有其他好的idea,欢迎随时向我们提PR,也欢迎动手加入我们~~~

I understand. I hope monaco-sql-languages can add this feature soon, as it is really important for developers.

Also, I noticed that monaco-sql-languages (or dt-sql-parser) only has built-in database keywords, but no function list. I think this feature is also very important for the user's autocomplete experience.

I have temporarily collected a list of database keywords and functions, but I don't know how to pass it to the dt-sql-parser project, because I noticed that it uses g4 syntax. But that's okay, I'm just throwing this out there as an idea.

Here's the repository address I collected: https://github.com/resetsix/db-keywords-and-functions

@Cythia828
Copy link
Collaborator

你好,感谢你的关注和使用。 关于别名作为实体收集这一功能预计会在未来半年内落地,目前正在向这个结果前进。如果你这边也在做这件事或者有其他好的idea,欢迎随时向我们提PR,也欢迎动手加入我们~~~

I understand. I hope monaco-sql-languages can add this feature soon, as it is really important for developers.

Also, I noticed that monaco-sql-languages (or dt-sql-parser) only has built-in database keywords, but no function list. I think this feature is also very important for the user's autocomplete experience.

I have temporarily collected a list of database keywords and functions, but I don't know how to pass it to the dt-sql-parser project, because I noticed that it uses g4 syntax. But that's okay, I'm just throwing this out there as an idea.

Here's the repository address I collected: https://github.com/resetsix/db-keywords-and-functions

OK,我们已经收到你们的意见了,正在加紧步伐~~~

另外,我们的monaco-sql-languages是有函数关键字的哦,可以查看languages文件夹下对应SQL的builtinFunctions配置,能够发现函数关键字也是有被罗列的哦~~~

@resetsix
Copy link
Contributor Author

resetsix commented Oct 16, 2024

另外,我们的monaco-sql-languages是有函数关键字的哦,可以查看languages文件夹下对应SQL的builtinFunctions配置,能够发现函数关键字也是有被罗列的哦~~~

I have a question: the auto-complete of monaco-sql-languages seems to be incomplete. The keywords in const { keywords, syntax } = suggestions; contain only keywords and not functions. For example, when I type a, only the keywords ADD and ALTER appear in the prompt, but no functions like ABS or ADDTIME. I don't know if this is a problem with monaco-sql-languages or my usage QAQ.

dtstack.github.io/monaco-sql-languages or mortalyoung.github.io/monaco-sql-languages/

图片

It should look like the following

图片

@Cythia828
Copy link
Collaborator

另外,我们的monaco-sql-languages是有函数关键字的哦,可以查看languages文件夹下对应SQL的builtinFunctions配置,能够发现函数关键字也是有被罗列的哦~~~

I have a question: the auto-complete of monaco-sql-languages seems to be incomplete. The keywords in const { keywords, syntax } = suggestions; contain only keywords and not functions. For example, when I type a, only the keywords ADD and ALTER appear in the prompt, but no functions like ABS or ADDTIME. I don't know if this is a problem with monaco-sql-languages or my usage QAQ.

dtstack.github.io/monaco-sql-languages or mortalyoung.github.io/monaco-sql-languages/

图片 It should look like the following 图片

你好。
关于你提的函数自动补全不全的问题,我们将使用频率较高的关键词/函数名等留在了dt-sql-parser内部,可作为自动补全项提示,如果目前自动补全的函数名无法满足你的需求,你可以调用setupLanguageFeatures去注入你自定义的补全项内容,自定义函数名也可完成自动补全,详细使用可以查看文档。

@resetsix
Copy link
Contributor Author

你好。 关于你提的函数自动补全不全的问题,我们将使用频率较高的关键词/函数名等留在了dt-sql-parser内部,可作为自动补全项提示,如果目前自动补全的函数名无法满足你的需求,你可以调用setupLanguageFeatures去注入你自定义的补全项内容,自定义函数名也可完成自动补全,详细使用可以查看文档。

感谢。setupLanguageFeatures的用法倒是没什么问题,就是好奇monaco-sql-languages已经内置了builtinFunctions但是在提示的时候只有关键字却没有函数 {{ (>_<) }}。

@mumiao
Copy link
Collaborator

mumiao commented Nov 19, 2024

@Cythia828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants