You can translate the question and the replies:

Fetching View's underlying query

Hi Denodo team, I have a requirement of fetching view and also the query through which this view is created if that view is created by query.I have tried GET_VIEWS(), CATALOG_VDP_METADATA_VIEWS() and CATALOG_METADATA_VIEWS() procedures.But none of them gives me the query code of the view. And in the similar way can I fetch the user defined procedures along with their source codes ? If yes how can I achieve that ? And third thing is, how can I fetch query logs from a particular database and datasource through query? Please help me with the above requirement.Your support is appreciated.Thanks in Advance. Thanks, Kranthi kiran.
user
15-10-2020 10:10:21 -0400
code

1 Answer

Hi, In order to get the VQL of a view, I would make use of the [**DESC VQL VIEW <view name>**](https://community.denodo.com/docs/html/browse/latest/vdp/vql/describing_catalog_elements/describing_catalog_elements#describing-catalog-elements) Command. Then, to obtain only user defined procedures, you can use the [**GET_ELEMENTS()**](https://community.denodo.com/docs/html/browse/latest/vdp/vql/stored_procedures/predefined_stored_procedures/get_elements#get-elements) Stored Procedure with condition like : > select name from GET_ELEMENTS() where type = 'storedProcedure' and subtype = 'user defined'; Lastly, if I want to fetch the queries of a particular database, I would create a Custom Data source with the [**Denodo Log Custom Wrapper**](https://community.denodo.com/kb/view/document/Reading%20the%20VDP%20logs%20with%20Denodo%20Log%20Custom%20Wrapper?category=Custom+Elements) or by creating a Delimited Datasource which points to the **vdp-queries.log** file under the "<DENODO_HOME>\logs\vdp" directory. After creating the views from this data source, I would put the necessary WHERE conditions for retrieving the queries from specific databases. Hope this helps!
Denodo Team
16-10-2020 08:53:59 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here