tableau / hyper-api-samples

Sample code to get started with the Hyper API.
https://help.tableau.com/current/api/hyper_api/en-us/index.html
MIT License
134 stars 72 forks source link

Request : Add CREATE VIEW #62

Closed rferraton closed 2 years ago

rferraton commented 2 years ago

Would it be possible to add new object like VIEW ?

vogelsgesang commented 2 years ago

Which goal are you pursuing with views?

Adding support for CREATE TEMPORARY VIEW would be straightforward to add to Hyper. If your goal is to better structure your SQL statements by using views, temporary views might be sufficient to achieve that.

On the other hand, if you want persisted views, those will be much more effort for us. If we gave you persisted views, you could embed arbitrary SQL in a .hyper file and then upload that file to Tableau Online. But our SQL interface is not yet bulletproof enough, and we don't feel comfortable executing arbitrary untrusted SQL inside the trust boundaries ofTableau Online, yet

rferraton commented 2 years ago

It was initially for using persisted views (for union all views) but i can understand your chilliness with SQL injection but i may miss something : how could a view be created directly in Tableau Cloud [now :-)] ? Is there a mean to run SQL in an Hyper directly in Tableau Cloud ? (avoiding re-publish datasource)

vogelsgesang commented 2 years ago

There is no way to run SQL directly against Tableau Online.

But if we supported CREATE VIEW, that view would need to be persisted in the .hyper file, and you could upload that Hyper file to Tableau Online. Tableau Online, when evaluating accessing the view, would then need to execute the SQL you provided as the view's definition...

rferraton commented 2 years ago

Run SQL directly against Tableau Online or Server would be great : in order to run a refresh from remote sources without the pain to download/republish the tdsx... Maybe later ?

For the view : when the view is created in the Hyper file, it's SQL content will be evaluated by a parser (?) and if the SQL content does not return a clean dataset the view would not be created, no ?

vogelsgesang commented 2 years ago

Run SQL directly against Tableau Online or Server would be great : in order to run a refresh from remote sources without the pain to download/republish the tdsx... Maybe later?

For the most common tasks (append to existing table, remove tuples from table, update existing tables...) you can already do so today using Tableau's Rest API. See https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_how_to_update_data_to_hyper.htm

For the view : when the view is created in the Hyper file, it's SQL content will be evaluated by a parser (?) and if the SQL content does not return a clean dataset the view would not be created, no ?

In theory: yes, the SQL is already validated upon creating the view. But Hyper's SQL is currently much more powerful than what Tableau Online actually uses. And while we are happy to let everyone use Hyper's SQL to its fullest, we don't want to have arbitrary SQL available on the Tableau Online (yet), before further hardening it against maliciously formulated SQL queries.

rferraton commented 2 years ago

I will double look and try this API : I saw it some weeks ago but understood it was for small amount of data.

Can't wait Hyper deliver it full capabilities to Tableau Cloud :-)

We can close the issue so, waiting for better security conditions ?

One last question : Do you think Hyper Engine could open it sources one day ?

vogelsgesang commented 2 years ago

We can close the issue so, waiting for better security conditions ?

Yes, I think there is no short-term solution we could provide... We could likely provide temporary, non-persisted views short-term but those won't solve your use case. We are (independently of HyperAPI) currently going through a general security uplift as part of the integration with/acquisition through Salesforce, so maybe the security implications of direct SQL access in Tableau Server will become better in the future

Do you think Hyper Engine could open it sources one day ?

That question is above my pay grade ;)