Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Dataform Post Operation - Auth views

Hi Team,

How to manage Auth view access management via Dataform post operations section? I can add a code in javascript but that need to be run after the view creation has been completed. Once view is created grant auth view access to destination dataset, 

As per my knowledge, post_operations is only for executing SQL commands. But how I can call JS function in this block?

@ms4446 

0 2 440
2 REPLIES 2

Dataform's post_operations section is specifically designed for executing SQL commands, and as of now, it does not support the direct use of JavaScript functions. This limitation can be challenging when you need to manage tasks like view access control, which often require more complex logic than SQL alone can provide.

Despite this, there are several workarounds available, each with its own advantages and drawbacks. One option is to manage view access externally using tools like Cloud Functions or Cloud Composer. This approach offers greater flexibility and control over when and how access is granted, but it also introduces additional complexity and potential points of failure, as it depends on external systems.

Another approach is to use the Dataform CLI or API to automate access management. By creating a script that interacts with Dataform, you can automatically grant access after views are created. This method keeps everything within the Dataform environment but requires some familiarity with the CLI or API and might involve custom development.

A hybrid solution is also possible, combining post_operations SQL with external scripting. For example, you could use post_operations to trigger an event that an external script then uses to manage access. This leverages Dataform's built-in features while allowing for external control, though it may require a more complex setup.

Thanks @ms4446