You can translate the question and the replies:

VQL Parser for Python

Hi, I would like to parse a VQL in Python in order to retrieve all elements of a VQL in a correct AST. Could you please tell me if such kind of parser already exists or if there is a way to get the VQL grammar somewhere ? I already found some fragments in the documentation but I feel like I will miss few things if I only go through all documentation pages. The finality of this is to make a desc VQL of a view or a datasource and replace few elements programmaticaly. Thanks in advance for you help. Regards, Johan
user
05-02-2021 13:23:47 -0500

3 Answers

Hi, The **DESC VQL** command is generally used to check the VQL which is generated while creating an element. In a situation where there is a need for creating,modifying,deleting or replacing Virtual DataPort elements(like views), I would use the appropriate VQL syntax. For instance to rename a column of a base view I would use the **alter** command. ``` ALTER TABLE bv_hotels( ALTER COLUMN col_name RENAME hotel_names ); ``` This query can also be passed to Denodo through [Python JDBC/ODBC ](https://community.denodo.com/kb/view/document/How%20to%20connect%20to%20Denodo%20from%20Python%20-%20a%20starter%20for%20Data%20Scientists?category=Northbound+Connections)connection. You can refer to the sections under [Virtual DataPort VQL](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/index) Guide to know more about the VQL commands and refer to the [Output Schema of the DESC Commands](https://community.denodo.com/docs/html/browse/8.0/en/vdp/developer/appendix/output_schema_of_the_desc_commands/output_schema_of_the_desc_commands) section of the Virtual DataPort Developer Guide for more information on the DESC command. Further , You can also refer to this similar[ Q&A](https://community.denodo.com/answers/question/details?questionId=9064u000000CeoxAAC&title=python+to+run+vql+shell+%28select+%2C+create+view%2C+desc+view%29) for more details. Hope this helps!
Denodo Team
08-02-2021 05:19:13 -0500
Is it possible to provide the VQL grammar or something similar ? A file that would describe how writes a correct VQL. Here is an example for python : https://docs.python.org/3/reference/grammar.html Or for java: https://docs.oracle.com/javase/specs/jls/se7/html/jls-18.html
user
11-02-2021 17:22:51 -0500
Hi, Currently, in order to display the grammar or syntax for a VQL query, I would make use of the **HELP** command in the Virtual DataPort Administration Tool. For example to get the syntax of **select** query, I would use the following statement in the VQL Shell of the Virtual DataPort Administration Tool: `HELP SELECT` Alternatively, if the need is to break down the query that is to be executed, I would make use of the **DESC** command. You can also find all the syntax used by VQL grammar under the [Virtual DataPort VQL Guide ](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/index). Hope this helps!
Denodo Team
19-02-2021 07:17:32 -0500
You must sign in to add an answer. If you do not have an account, you can register here