sundeck-io / OpsCenter

OpsCenter for Snowflake makes it easy to understand and manage your Snowflake consumption
Other
25 stars 15 forks source link

Selectively reintroduce run_as_app #647

Closed joshelser closed 6 months ago

jacques-n commented 6 months ago

New idea. I bet we can read current_organization_name() in setup script. We could then look at the sharing organization of the app we're installing and if the current organization is the same as the installing organization, add this function. I feel like something along these lines would be much better than creating a Sundeck specific callout.

joshelser commented 6 months ago

I bet we can read current_organization_name() in setup script

I'll check. My gut reaction is that we can't use context functions in the setup script, but I'm not positive.

We could then look at the sharing organization of the app we're installing and if the current organization is the same as the installing organization

Yep, I see what you mean. I'll see if that's feasible in the setup script.

joshelser commented 6 months ago

We could then look at the sharing organization of the app we're installing

I thought we could do something like this:

describe application `select current_database()`;
app_org = select "value" from table(result_scan(last_query_id())) where "property" = 'source_organization';

But we can't call describe application in the setup script. Is there some other way I'm not thinking of to get at the application source information?

joshelser commented 6 months ago

bummer we couldn't figure out way to reference the provider_organization_name().

Yeah. I'll check with Ryan next time we talk -- maybe there's something I missed which will let us generalize this.