# Google Cloud Dataplex V1 Client - Class DataQualityRule (1.14.0)

1.14.0 (latest) 1.13.0 1.12.0 1.11.0 1.10.0 1.9.1 1.8.0 1.7.1 1.6.1 1.4.0 1.3.0 1.2.1 1.1.1 1.0.1 0.16.1 0.15.1 0.14.0 0.13.0 0.12.0 0.11.1 0.10.0 0.9.0 0.8.0 0.7.0 0.6.0 0.5.1 0.4.0 0.3.0 0.2.3 0.1.6 Reference documentation and code samples for the Google Cloud Dataplex V1 Client class DataQualityRule.

A rule captures data quality intent about a data source.

Generated from protobuf message `google.cloud.dataplex.v1.DataQualityRule`

## Namespace

Google \\ Cloud \\ Dataplex \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ range_expectation` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RangeExpectation` Row-level rule which evaluates whether each column value lies between a specified range. |
| `↳ non_null_expectation` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.NonNullExpectation` Row-level rule which evaluates whether each column value is null. |
| `↳ set_expectation` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.SetExpectation` Row-level rule which evaluates whether each column value is contained by a specified set. |
| `↳ regex_expectation` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RegexExpectation` Row-level rule which evaluates whether each column value matches a specified regex. |
| `↳ uniqueness_expectation` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.UniquenessExpectation` Row-level rule which evaluates whether each column value is unique. |
| `↳ statistic_range_expectation` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.StatisticRangeExpectation` Aggregate rule which evaluates whether the column aggregate statistic lies between a specified range. |
| `↳ row_condition_expectation` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RowConditionExpectation` Row-level rule which evaluates whether each row in a table passes the specified condition. |
| `↳ table_condition_expectation` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.TableConditionExpectation` Aggregate rule which evaluates whether the provided expression is true for a table. |
| `↳ sql_assertion` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.SqlAssertion` Aggregate rule which evaluates the number of rows returned for the provided statement. If any rows are returned, this rule fails. |
| `↳ template_reference` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.TemplateReference` Aggregate rule which references a rule template and provides the parameters to be substituted in the template. If any rows are returned, this rule fails. |
| `↳ column` | `string` Optional. The unnested column which this rule is evaluated against. |
| `↳ ignore_null` | `bool` Optional. Rows with `null` values will automatically fail a rule, unless `ignore_null` is `true`. In that case, such `null` rows are trivially considered passing. This field is only valid for the following type of rules: \* \* RangeExpectation \* \* RegexExpectation \* \* SetExpectation \* \* UniquenessExpectation |
| `↳ dimension` | `string` Optional. The dimension a rule belongs to. Results are also aggregated at the dimension level. Custom dimension name is supported with all uppercase letters and maximum length of 30 characters. |
| `↳ threshold` | `float` Optional. The minimum ratio of **passing_rows / total_rows** required to pass this rule, with a range of \[0.0, 1.0\]. 0 indicates default value (i.e. 1.0). This field is only valid for row-level type rules. |
| `↳ name` | `string` Optional. A mutable name for the rule. \* \* The name must contain only letters (a-z, A-Z), numbers (0-9), or hyphens (-). \* \* The maximum length is 63 characters. \* \* Must start with a letter. \* \* Must end with a number or a letter. |
| `↳ description` | `string` Optional. Description of the rule. \* \* The maximum length is 1,024 characters. |
| `↳ suspended` | `bool` Optional. Whether the Rule is active or suspended. Default is false. |
| `↳ attributes` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. Map of attribute name and value linked to the rule. The rules to evaluate can be filtered based on attributes provided here and a filter expression provided in the DataQualitySpec.filter field. |
| `↳ rule_source` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RuleSource` Output only. Contains information about the source of the rule and its relationship with the BigQuery table, where applicable. |
| `↳ debug_queries` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.DebugQuery>` Optional. Specifies the debug queries for this rule. Currently, only one query is supported, but this may be expanded in the future. |

### getRangeExpectation

Row-level rule which evaluates whether each column value lies between a
specified range.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RangeExpectation|null` |   |

### hasRangeExpectation

### setRangeExpectation

Row-level rule which evaluates whether each column value lies between a
specified range.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RangeExpectation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getNonNullExpectation

Row-level rule which evaluates whether each column value is null.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.NonNullExpectation|null` |   |

### hasNonNullExpectation

### setNonNullExpectation

Row-level rule which evaluates whether each column value is null.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.NonNullExpectation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSetExpectation

Row-level rule which evaluates whether each column value is contained by
a specified set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.SetExpectation|null` |   |

### hasSetExpectation

### setSetExpectation

Row-level rule which evaluates whether each column value is contained by
a specified set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.SetExpectation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRegexExpectation

Row-level rule which evaluates whether each column value matches a
specified regex.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RegexExpectation|null` |   |

### hasRegexExpectation

### setRegexExpectation

Row-level rule which evaluates whether each column value matches a
specified regex.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RegexExpectation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUniquenessExpectation

Row-level rule which evaluates whether each column value is unique.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.UniquenessExpectation|null` |   |

### hasUniquenessExpectation

### setUniquenessExpectation

Row-level rule which evaluates whether each column value is unique.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.UniquenessExpectation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getStatisticRangeExpectation

Aggregate rule which evaluates whether the column aggregate
statistic lies between a specified range.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.StatisticRangeExpectation|null` |   |

### hasStatisticRangeExpectation

### setStatisticRangeExpectation

Aggregate rule which evaluates whether the column aggregate
statistic lies between a specified range.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.StatisticRangeExpectation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRowConditionExpectation

Row-level rule which evaluates whether each row in a table passes the
specified condition.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RowConditionExpectation|null` |   |

### hasRowConditionExpectation

### setRowConditionExpectation

Row-level rule which evaluates whether each row in a table passes the
specified condition.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RowConditionExpectation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTableConditionExpectation

Aggregate rule which evaluates whether the provided expression is true
for a table.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.TableConditionExpectation|null` |   |

### hasTableConditionExpectation

### setTableConditionExpectation

Aggregate rule which evaluates whether the provided expression is true
for a table.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.TableConditionExpectation` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSqlAssertion

Aggregate rule which evaluates the number of rows returned for the
provided statement. If any rows are returned, this rule fails.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.SqlAssertion|null` |   |

### hasSqlAssertion

### setSqlAssertion

Aggregate rule which evaluates the number of rows returned for the
provided statement. If any rows are returned, this rule fails.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.SqlAssertion` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTemplateReference

Aggregate rule which references a rule template and provides the
parameters to be substituted in the template. If any rows are returned,
this rule fails.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.TemplateReference|null` |   |

### hasTemplateReference

### setTemplateReference

Aggregate rule which references a rule template and provides the
parameters to be substituted in the template. If any rows are returned,
this rule fails.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.TemplateReference` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getColumn

Optional. The unnested column which this rule is evaluated against.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setColumn

Optional. The unnested column which this rule is evaluated against.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIgnoreNull

Optional. Rows with `null` values will automatically fail a rule, unless
`ignore_null` is `true`. In that case, such `null` rows are trivially
considered passing.

This field is only valid for the following type of rules:

- RangeExpectation
- RegexExpectation
- SetExpectation
- UniquenessExpectation

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setIgnoreNull

Optional. Rows with `null` values will automatically fail a rule, unless
`ignore_null` is `true`. In that case, such `null` rows are trivially
considered passing.

This field is only valid for the following type of rules:

- RangeExpectation
- RegexExpectation
- SetExpectation
- UniquenessExpectation

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDimension

Optional. The dimension a rule belongs to. Results are also aggregated at
the dimension level. Custom dimension name is supported with all uppercase
letters and maximum length of 30 characters.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDimension

Optional. The dimension a rule belongs to. Results are also aggregated at
the dimension level. Custom dimension name is supported with all uppercase
letters and maximum length of 30 characters.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getThreshold

Optional. The minimum ratio of **passing_rows / total_rows** required to
pass this rule, with a range of \[0.0, 1.0\].

0 indicates default value (i.e. 1.0).
This field is only valid for row-level type rules.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### setThreshold

Optional. The minimum ratio of **passing_rows / total_rows** required to
pass this rule, with a range of \[0.0, 1.0\].

0 indicates default value (i.e. 1.0).
This field is only valid for row-level type rules.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getName

Optional. A mutable name for the rule.

- The name must contain only letters (a-z, A-Z), numbers (0-9), or hyphens (-).
- The maximum length is 63 characters.
- Must start with a letter.
- Must end with a number or a letter.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Optional. A mutable name for the rule.

- The name must contain only letters (a-z, A-Z), numbers (0-9), or hyphens (-).
- The maximum length is 63 characters.
- Must start with a letter.
- Must end with a number or a letter.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDescription

Optional. Description of the rule.

- The maximum length is 1,024 characters.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDescription

Optional. Description of the rule.

- The maximum length is 1,024 characters.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSuspended

Optional. Whether the Rule is active or suspended.

Default is false.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setSuspended

Optional. Whether the Rule is active or suspended.

Default is false.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAttributes

Optional. Map of attribute name and value linked to the rule. The rules to
evaluate can be filtered based on attributes provided here and a filter
expression provided in the DataQualitySpec.filter field.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setAttributes

Optional. Map of attribute name and value linked to the rule. The rules to
evaluate can be filtered based on attributes provided here and a filter
expression provided in the DataQualitySpec.filter field.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRuleSource

Output only. Contains information about the source of the rule and its
relationship with the BigQuery table, where applicable.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RuleSource|null` |   |

### hasRuleSource

### clearRuleSource

### setRuleSource

Output only. Contains information about the source of the rule and its
relationship with the BigQuery table, where applicable.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.RuleSource` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDebugQueries

Optional. Specifies the debug queries for this rule.

Currently, only one query is supported, but this may be expanded in the
future.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.DebugQuery>` |   |

### setDebugQueries

Optional. Specifies the debug queries for this rule.

Currently, only one query is supported, but this may be expanded in the
future.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dataplex/latest/V1.DataQualityRule.DebugQuery>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRuleType

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |