All Products
Search
Document Center

Data Management:DSL syntax for security rules

Last Updated:Mar 28, 2026

Data Management (DMS) provides a domain-specific language (DSL) to define security rules for database development workflows. Use DSL rules to control which SQL statements can be submitted, how approvals are routed, and when operations are blocked or flagged as risky.

How it works

A security rule is an IF-THEN or IF-THEN-ELSE statement. When a condition is met, DMS performs the corresponding action.

Basic structure:

if <condition>
then <action>
end

Extended structure with multiple branches:

if <condition 1>
then <action 1>
elseif <condition 2>
then <action 2>
[else <action 3>]
end

Each rule must contain exactly one if condition. It can have zero or more elseif branches and zero or one else clause. If no branch matches and there is no else clause, DMS takes no action.

DSL components

A security rule consists of three building blocks: conditional clauses, action clauses, and predefined functions.

Conditional clauses

A conditional clause evaluates to true or false. It is built from one or more of the following:

  • Factors — predefined system variables that represent context at the time of evaluation (for example, SQL statement type, number of affected rows)

  • Operators — symbols that compare or test values

  • ConnectorsAND and OR, which combine multiple expressions

AND has higher priority than OR. Both have lower priority than operators. Use parentheses to override the default evaluation order.

Example: In 1 <= 0 or 1 == 1, DMS evaluates 1 <= 0 and 1 == 1 separately, then applies OR. To make priority explicit: (1 <= 0) == true.

Operators

Operators connect factors and constants in conditional expressions. The following operators are supported:

OperatorDescriptionExample
==Equal to1 == 1
!=Not equal to1 != 2
>Greater than@fac.insert_rows > 1000
>=Greater than or equal to@fac.insert_rows >= 1000
<Less than@fac.insert_rows < 100
<=Less than or equal to@fac.insert_rows <= 100
inBelongs to an array'a' in ['a', 'b', 'c']
not inDoes not belong to an array'a' not in ['a', 'b', 'c']
matchsMatches a regular expression'idx_aa' matchs 'idx_\\w+'
not matchsDoes not match a regular expression'idx_aa' not matchs 'idx_\\w+'
isBlankValue is empty'' isBlank
isNotBlankValue is not empty'' isNotBlank

Backslash escaping in regular expressions: To include a literal backslash (\) in a regex pattern, escape it with another backslash. For example, write idx_\\w+ to match idx_\w+.

Factors

Factors are predefined variables that provide context at security rule evaluation time — such as the SQL statement type, the number of rows affected, or whether the target is a logical database. Use them in conditional clauses to write rules based on real operation metadata.

A factor name uses the format @fac.<display-name>. DMS provides different factors for different checkpoints in each module.

FactorDescription
@fac.env_typeEnvironment type. Example values: DEV, PRODUCT. See Change the environment type for an instance.
@fac.sql_typeSQL statement type. Example values: UPDATE, INSERT.
@fac.detail_typeData change ticket type. See valid values below.
@fac.is_logicWhether the target database is a logical database.
@fac.extra_infoOther ticket information. Not currently in use.
@fac.is_ignore_affect_rowsWhether to skip row-count validation.
@fac.insert_rowsNumber of rows to be inserted.
@fac.update_delete_rowsNumber of rows to be updated or deleted.
@fac.max_alter_table_sizeSize of the largest tablespace containing the table to be modified.
@fac.is_has_security_columnWhether the SQL statement involves sensitive fields.
@fac.security_column_listSensitive fields involved in the SQL statement.
@fac.risk_levelRisk level of the operation.
@fac.risk_reasonReason for the assigned risk level.

Valid values for `@fac.detail_type`:

ValueTicket type
COMMONNormal Data Modify
CHUNK_DMLLockless Change
PROCEDUREProgrammable Object
CRON_CLEAR_DATAHistory Data Clean
BIG_FILELarge Data Import

Example: Check whether an SQL statement is a DML statement:

@fac.sql_type == 'DML'

Action clauses

An action defines what DMS does when a condition is met. Action names use the format @act.<display-name>. DMS provides different actions for different checkpoints in each module.

ActionDescription
@act.allow_submitRequires the submission of SQL statements to be executed in a ticket.
@act.allow_execute_directAllows execution of SQL statements in SQL Console.
@act.forbid_executeBlocks execution of SQL statements.
@act.mark_riskMarks the operation with a risk level and a custom message. Example: @act.mark_risk 'middle' 'Medium risk: online environment'
@act.do_not_approveSpecifies the ID of an approval template. See Configure approval processes.
@act.choose_approve_templateSelects an approval template.
@act.choose_approve_template_with_reasonSelects an approval template and includes a reason.

Predefined functions

Predefined functions can be used in both conditional clauses and action clauses. Function names use the format @fun.<display-name>.

FunctionInputOutputDescription
@fun.concatMultiple stringsStringConcatenates strings into one.
@fun.char_lengthA stringIntegerReturns the length of a string.
@fun.is_char_lowerA stringBooleanReturns true if all letters are lowercase.
@fun.is_char_upperA stringBooleanReturns true if all letters are uppercase.
@fun.array_sizeAn arrayIntegerReturns the number of elements in an array.
@fun.addMultiple numeric valuesNumericAdds multiple values.
@fun.subTwo numeric valuesNumericSubtracts the second value from the first.
@fun.betweenThree values: target, lower bound, upper boundBooleanReturns true if the target falls within the closed range [lower, upper]. Supports NUMERIC, DATE, and TIME types.
@fun.current_datetimeNoneStringReturns the current date and time in yyyy-MM-dd HH:mm:ss format.
@fun.current_dateNoneStringReturns the current date in yyyy-MM-dd format.
@fun.current_timeNoneStringReturns the current time in HH:mm:ss format.
@fun.is_contain_strTwo stringsBooleanReturns true if the first string contains the second.
@fun.listEqualIgnoreOrderTwo string listsBooleanReturns true if both lists contain the same strings, regardless of order or case.

Selected examples:

String concatenation:

@fun.concat('d', 'm', 's')
// Output: 'dms'
@fun.concat('[Development standards] Enter a comment for the [', @fac.column_name, '] field.')
// Output: a reminder message with the field name inserted

Checking whether a numeric value falls within a range:

@fun.between(@fac.export_rows, 2001, 100000)
// Returns true if the number of exported rows is between 2,001 and 100,000
@fun.between(@fun.current_datetime(), '2019-10-31 00:00:00', '2019-11-04 00:00:00')
// Returns true if the current date and time fall within the specified window

Checking list equality:

@fun.listEqualIgnoreOrder(@fac.perm_type, ['QUERY'])
// Returns true if only the query permission is requested
@fun.listEqualIgnoreOrder(@fac.perm_type, ['CORRECT', 'EXPORT'])
// Returns true if both the change and export permissions are requested

Examples

Limit the number of SQL statements per ticket

Block submission if a ticket contains more than 1,000 SQL statements:

if
    @fac.sql_count > 1000
then
    @act.reject_execute 'The number of SQL statements in a ticket cannot exceed 1,000.'
end

If the count exceeds 1,000, DMS rejects the ticket and displays the message.

Allow only DML statements

Allow submission only when all SQL statements are DML operations:

if
    @fac.sql_type in ['UPDATE', 'DELETE', 'INSERT', 'INSERT_SELECT']
then
    @act.allow_submit
end