Categories:

System functions (System Control)

SYSTEM$UNMANAGE_FROM_DCM_PROJECT

Removes entities, grants, and data metric function attachments from the management scope of a DCM project without dropping, revoking, or detaching them. You specify what to unmanage with the same statements that you use in the project definition files.

See also:

SYSTEM$UNMANAGE_ENTITY_FROM_DCM_PROJECT, Unmanage entities, grants, and attachments from a DCM project

Syntax

SYSTEM$UNMANAGE_FROM_DCM_PROJECT(
  '<project_name>' ,
  '<definitions>' )

Arguments

'project_name'

Name of the DCM project that currently manages the entities, grants, and data metric function attachments, for example my_db.my_schema.my_project.

'definitions'

String that contains one or more statements, each terminated by a semicolon, that identify what to unmanage. The function accepts DEFINE, GRANT, and ATTACH DATA METRIC FUNCTION statements as they appear in DCM Projects definition files. ATTACH TAG and policy attachments aren’t supported. For more information, see Limitations.

Because definition statements often contain single quotes, use a dollar-quoted string constant to avoid escaping them.

Returns

Returns the number of items that were unmanaged. Each DEFINE, GRANT, and ATTACH DATA METRIC FUNCTION item counts, so grants and data metric function attachments are included in the count. For example, a call with one DEFINE, one GRANT, and one ATTACH DATA METRIC FUNCTION statement returns 3.

Statements for items that the DCM project doesn’t manage aren’t included in the count. For more information, see the usage notes.

Access control requirements

A role used to execute this operation must have the following privileges at a minimum:

PrivilegeObjectNotes
OWNERSHIPDCM projectMONITOR or READ on the DCM project isn’t sufficient.
AnyEach entity that the statements referenceThe entity must be visible to the role. For example, SELECT on a table is sufficient. OWNERSHIP of the entity isn’t required.

Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema.

For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.

For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Usage notes

  • Unmanaging doesn’t drop entities, revoke grants, or detach data metric functions. They remain in place, and only the DCM project’s tracking of them is removed.

  • Each statement must match the statement as written in the project definition files. You can copy the statements from your definition files into the function argument.

  • The function accepts only plain SQL and doesn’t support Jinja templating. If your definition files use Jinja templating, pass the rendered statements.

  • The function processes the statements as a single batch:

    • If any statement contains a syntax error or references an object that doesn’t exist, the whole call fails and nothing is unmanaged.
    • If a statement refers to an item that the DCM project doesn’t manage, such as a grant that was never managed or an entity that was already unmanaged, the function skips that statement without an error. The function still processes the other statements, and the skipped statement isn’t included in the returned count.
  • After you unmanage the entities, grants, and data metric function attachments, remove the corresponding statements from your project definition files before the next deployment. Otherwise, the DCM project manages them again.

Limitations

  • Of the ATTACH statements, the function supports only ATTACH DATA METRIC FUNCTION. Unmanaging tag attachments (ATTACH TAG) and policy attachments, such as ATTACH MASKING POLICY, isn’t supported.

Examples

The following example unmanages a table, a grant on that table, and a data metric function attachment from the DCM project DCM_DEMO.PROJECTS.DCM_PROJECT_DEV:

SELECT SYSTEM$UNMANAGE_FROM_DCM_PROJECT(
  'DCM_DEMO.PROJECTS.DCM_PROJECT_DEV',
  $$
    DEFINE TABLE sales.public.orders (id NUMBER);

    GRANT SELECT, INSERT ON TABLE sales.public.orders TO ROLE analyst;

    ATTACH DATA METRIC FUNCTION sales.public.not_null
      TO TABLE sales.public.orders
      ON (id);
  $$);