| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Napkin.Spec.Yaml.Types.Hooks
Synopsis
- type HookForYaml b = SpecProgramReferenceForYaml (HookProgram b)
- newtype YamlRange a = YamlRange {}
- data YamlRangeType
- assert_count :: HookForYaml b
- newtype ColumnOrExpression = ColumnOrExpression (Either SExp Text)
- parseColumnsOrExpressions :: forall (r :: EffectRow). Members '[SqlParse :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type] r => ColumnOrExpression -> Sem r SExp
- external :: HookForYaml b
- assert_unique :: HookForYaml b
- assert_all_values_within :: HookForYaml b
- assert_any_values_within :: HookForYaml b
- assert_no_values_within :: HookForYaml b
- assertValues :: Object -> (forall a. Val a => WithinSet a -> HookProgram b) -> WarningParser (HookProgram b)
- assert_expression :: HookForYaml b
- assert_not_null :: HookForYaml b
- assert_cardinalities :: HookForYaml b
- assert_multiple_columns_cardinalities :: HookForYaml b
Documentation
type HookForYaml b = SpecProgramReferenceForYaml (HookProgram b) #
Instances
| (FromJSON a, Val a) => FromJSON (YamlRange a) # | |||||
Defined in Napkin.Spec.Yaml.Types.Hooks | |||||
| (ToJSON a, Val a) => ToJSON (YamlRange a) # | |||||
| Generic (YamlRange a) # | |||||
Defined in Napkin.Spec.Yaml.Types.Hooks Associated Types
| |||||
| Show a => Show (YamlRange a) # | |||||
| Eq a => Eq (YamlRange a) # | |||||
| type Rep (YamlRange a) # | |||||
Defined in Napkin.Spec.Yaml.Types.Hooks | |||||
data YamlRangeType #
Instances
assert_count :: HookForYaml b #
Assert the relationship between table and another table or constant value
Supported checks: equal, greater_than, greater_than_or_equal, less_than, less_than_or_equal, approximately_equal (relative, absolute – see example below).
assert_count: table: target_table equal: source_table
assert_count: table: target_table greater_than_or_equal: 871
Approximate equality:
assert_count: table: target_table approximately_equal: source_table type: relative tolerance: 0.01
newtype ColumnOrExpression #
Constructors
| ColumnOrExpression (Either SExp Text) |
Instances
| FromJSON ColumnOrExpression # | |
Defined in Napkin.Spec.Yaml.Types.Hooks Methods parseJSON :: Value -> Parser ColumnOrExpression # parseJSONList :: Value -> Parser [ColumnOrExpression] # | |
parseColumnsOrExpressions :: forall (r :: EffectRow). Members '[SqlParse :: (Type -> Type) -> Type -> Type, FatalError :: (Type -> Type) -> Type -> Type] r => ColumnOrExpression -> Sem r SExp #
external :: HookForYaml b #
Define a hook with external shell script or command with arguments
external:
shell: ./execute_hook.sh --connection "{{{db_url}}}" --table "{{{table.db}}}"or > external: > command: ./execute_hook.sh > arguments: > - --connection "{{{db_url}}}" > - --table "{{{table.db}}}"
assert_unique :: HookForYaml b #
Assert that table has all rows unique in terms of selected columns.
assert_unique: table: target_table columns: [Artist, Title]
assert_all_values_within :: HookForYaml b #
Assert that table have only values within specified set in a certain column
assert_all_values_within: table: target_table column: target_column type: date from: 2009-01-01 to: 2013-12-31
or
assert_all_values_within: table: target_table column: target_column values: [StringOne, StringTwo]
assert_any_values_within :: HookForYaml b #
Assert that table have any values within specified set in a certain column
assert_any_values_within: table: target_table column: target_column type: date from: 2009-01-01 to: 2013-12-31
or > assert_any_values_within: > table: target_table > column: target_column > values: [StringOne, StringTwo]
assert_no_values_within :: HookForYaml b #
Assert that table have no values within specified set in a certain column
assert_no_values_within: table: target_table column: target_column type: date from: 2009-01-01 to: 2013-12-31
or > assert_no_values_within: > table: target_table > column: target_column > values: [StringOne, StringTwo]
assertValues :: Object -> (forall a. Val a => WithinSet a -> HookProgram b) -> WarningParser (HookProgram b) #
assert_expression :: HookForYaml b #
Assert expression is true
assert_expression: table: target_table expression: AVG(total) = 42
assert_not_null :: HookForYaml b #
Fail if any of the given expressions/columns have any NULL values.
assert_not_null:
table: target_table
columns:
- zip_code
- expression: NULLIF(zip_code, '')assert_cardinalities :: HookForYaml b #
Checks the cardinalities of multiple columns that may be sourced from different tables.
assert_cardinalities:
table: target_table
column: column_foo
equal:
source_table_foo:
- column_bar
- column_baz
source_table_bar:
- column_barassert_multiple_columns_cardinalities :: HookForYaml b #
Checks the cardinalities of multiple columns
assert_multiple_columns_cardinalities:
table: target_table
columns:
- column_foo
- column_thud
equal:
table: source_table_foo:
columns:
- column_bar
- column_baz