I am trying to set up a notebook to configure the basics of a catalog and its schemas, permissions etc for our developers can be "set loose"...
I have a parameter set as a widget: v_catalog contains a valid catalog name "dev_catalog".
I have tried this on serverless and on a cluster, and in case it matters this is "Azure Databricks".
While the first two commands (USE CATALOG, COMMENT) both work, none of the others (ALTER, GRANT) are working, and the error messages are generally "SYNTAX ERROR" which is not at all helpful.
How can I parameterize the DDL in this notebook?
I would also like to parameterize the AD_GROUP_NAME value too, eventually (and I have checked that AD_GROUP_NAME is correct and it does exist).
I am rather surprised that current_catalog() does not work. The error here is complaining about the first ( in current_catalog() for some reason....
USE CATALOG IDENTIFIER(:v_catalog);
COMMENT ON CATALOG IDENTIFIER(:v_catalog) IS 'This is a comment on my Catalog';
-- All These Fail...
ALTER CATALOG current_catalog() SET OWNER TO `AD_GROUP_NAME`;
ALTER CATALOG IDENTIFIER(:v_catalog) SET OWNER TO `AD_GROUP_NAME`;
ALTER CATALOG :v_actcat SET OWNER TO `AD_GROUP_NAME`;
ALTER CATALOG `:v_actcat` SET OWNER TO `AD_GROUP_NAME`;
ALTER CATALOG SET OWNER TO `AD_GROUP_NAME`; -- I thought I'd try this but wasnt expecting it to work, and it doesn't.
-- All These Fail...
GRANT SELECT ON CATALOG current_catalog() TO `AD_GROUP_NAME`;
GRANT SELECT ON CATALOG IDENTIFIER(:v_catalog) TO `AD_GROUP_NAME`;
GRANT SELECT ON CATALOG :v_actcat TO `AD_GROUP_NAME`;
GRANT SELECT ON CATALOG `:v_actcat` TO `AD_GROUP_NAME`;