Skip to content

Commit

Permalink
Update documentation with most recent SQL samples.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrczarnas committed May 7, 2024
1 parent 91fa2ca commit dfb42f1
Show file tree
Hide file tree
Showing 18 changed files with 211 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ class ColumnTypeSnapshotSpec:
length (Union[Unset, int]): Maximum length of text and binary columns.
precision (Union[Unset, int]): Precision of a numeric (decimal) data type.
scale (Union[Unset, int]): Scale of a numeric (decimal) data type.
nested (Union[Unset, bool]): This field is a nested field inside another STRUCT. It is used to identify nested
fields in JSON files.
"""

column_type: Union[Unset, str] = UNSET
nullable: Union[Unset, bool] = UNSET
length: Union[Unset, int] = UNSET
precision: Union[Unset, int] = UNSET
scale: Union[Unset, int] = UNSET
nested: Union[Unset, bool] = UNSET
additional_properties: Dict[str, Any] = _attrs_field(init=False, factory=dict)

def to_dict(self) -> Dict[str, Any]:
Expand All @@ -32,6 +35,7 @@ def to_dict(self) -> Dict[str, Any]:
length = self.length
precision = self.precision
scale = self.scale
nested = self.nested

field_dict: Dict[str, Any] = {}
field_dict.update(self.additional_properties)
Expand All @@ -46,6 +50,8 @@ def to_dict(self) -> Dict[str, Any]:
field_dict["precision"] = precision
if scale is not UNSET:
field_dict["scale"] = scale
if nested is not UNSET:
field_dict["nested"] = nested

return field_dict

Expand All @@ -62,12 +68,15 @@ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:

scale = d.pop("scale", UNSET)

nested = d.pop("nested", UNSET)

column_type_snapshot_spec = cls(
column_type=column_type,
nullable=nullable,
length=length,
precision=precision,
scale=scale,
nested=nested,
)

column_type_snapshot_spec.additional_properties = d
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class DuckdbStorageType(str, Enum):
AZURE = "azure"
LOCAL = "local"
S3 = "s3"

Expand Down
40 changes: 20 additions & 20 deletions docs/checks/column/text/text-length-above-max-length-percent.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ spec:
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -341,7 +341,7 @@ spec:
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down Expand Up @@ -1065,7 +1065,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -1085,7 +1085,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down Expand Up @@ -1908,7 +1908,7 @@ spec:
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -1929,7 +1929,7 @@ spec:
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down Expand Up @@ -2654,7 +2654,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -2674,7 +2674,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down Expand Up @@ -3497,7 +3497,7 @@ spec:
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -3518,7 +3518,7 @@ spec:
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down Expand Up @@ -4243,7 +4243,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -4263,7 +4263,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down Expand Up @@ -5096,7 +5096,7 @@ spec:
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -5117,7 +5117,7 @@ spec:
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down Expand Up @@ -5856,7 +5856,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -5876,7 +5876,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down Expand Up @@ -6707,7 +6707,7 @@ spec:
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -6728,7 +6728,7 @@ spec:
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down Expand Up @@ -7467,7 +7467,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT({{ lib.render_target_column('analyzed_table') }}) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH({{ lib.render_target_column('analyzed_table')}}) > {{(parameters.max_length)}}
WHEN LENGTH(CAST({{ lib.render_target_column('analyzed_table')}} AS CHAR)) > {{(parameters.max_length)}}
THEN 1
ELSE 0
END
Expand All @@ -7487,7 +7487,7 @@ Expand the *Configure with data grouping* section to see additional examples for
WHEN COUNT(analyzed_table.`target_column`) = 0 THEN 0.0
ELSE 100.0 * SUM(
CASE
WHEN LENGTH(analyzed_table.`target_column`) > 100
WHEN LENGTH(CAST(analyzed_table.`target_column` AS CHAR)) > 100
THEN 1
ELSE 0
END
Expand Down
Loading

0 comments on commit dfb42f1

Please sign in to comment.