Update virtual dataset query using rest api

Hi there,

I’m currently trying to update the sql-query of an existing VDS using the rest-api. I have written a function in python, that does the following:

  • get the VDS-ID using {dremio_url}/api/v3/catalog/by-path/
  • create the json-payload containing the new sql-statement
  • POST the payload to {dremio_url}/api/v3/catalog/{vds_id}

My payload looks like this:

{
'entityType': 'dataset', 
'id': 'my-dataset-id', 
'type': 'VIRTUAL_DATASET', 
'path': [
	'some_path', 
	'that_does', 
	'not_change'
	], 
'createdAt': '2022-05-04T13:10:31.398Z', 
'tag': 'some_fancy_tag', 
'sql': 'my_sql_statement', 
'sqlContext': [
	'some_context', 
	'that_does', 
	'not_change'
	], 
'fields': [fields_remain_unchanged]
}

I retrieve this payload directly from the catalog/by-path-call mentioned above and I only change the sql-statement - everything else remains the same.

Now for my problem:

When I execute this function, I get an error message that says: Promoting can only create physical datasets. When I remove the VDS-ID from the POST-url (the api-documentation is unclear about this imo, see here: Dremio HTTP-Request vs Python-Example) I get another error that says: Dataset id is immutable. However I’m not trying to change the ID, I just want to change the sql-query.

Since I couldn’t find anyone with the same problem, I guess I must be doing something wrong. I can post my code if that helps, I just don’t want to make this post too long right now. Any help would be greatly appreciated.

Cheers!
Kiro