The plan doesn’t complete, so it just says failed. Here is the error, it cut off the table from the name and is trying to treat the folder as the table.
View SQL alter table datasource.bucket.user.folder.tbl refresh metadata
@swarren we actually don’t officially support saving commands as a part of VDS definitions – so I wouldn’t recommend relying on this long-term. In this example, the problem might be caused by the VDS context. You can experiment with this in the UI by opening the SQL editor and clicking on context on the lower right hand side of the editor.
Behaves the same regardless of context. Steps to reproduce:
click “new query”
enter ‘alter table datasource.bucket.tbl refresh metadata’
click “save as”
click “dataset”
click “query” on the new VDS.
You get the error immediately.
In terms of needing this feature, my goal is to make it so I don’t reference PDSs directly in REST API requests. Currently the only way to force a metadata refresh is with “alter table” and I was hoping to embed the command in a VDS so I could invoke that command using the REST API without having to directly reference the PDS. When you invoke it from the “Run” or “Preview” button it works, but invoking it externally does not (through the query button or “select * from refresh_tbl”)
If the ability to save this command as a VDS goes away, what is the suggested way to do what I’m requesting? If I execute “alter table VDS refresh metadata”… will/should that refresh the metadata on PDSs that are used by the VDS?
@swarren thanks for the details and the feedback.
What’s driving your decision to not reference PDSs directly in REST API? Is it convenience, security or something else? We are thinking of a few ways to make it simpler to refresh all relevant PDS metadata for a given VDS without users having to figure it out (similar to your example).
The main driver is that I want a clean “API” for requests sent via the REST API. Currently all requests can come in to published VDSs which then map to PDSs (which I am free to change as long as I don’t change the VDS definitions). For example, I may move some PDSs from S3 to EBS for performance reasons, or vice versa for cost reasons.
I need to make “refresh metadata” requests through the “API” because there is no other way to achieve a metadata refresh “on parquet file added”.