@@ -162,15 +162,15 @@ def add_uniqueness_constraint(
162
162
) -> None :
163
163
"""Columns should uniquely identify row.
164
164
165
- Given a set of columns, satisfy conditions of a primary key, i.e.
166
- uniqueness of tuples from said columns. This constraint has a tolerance
167
- for inconsistencies, expressed via max_duplicate_fraction. The latter
165
+ Given a list of columns ``columns``, validate the condition of a primary key, i.e.
166
+ uniqueness of tuples in said columns. This constraint has a tolerance
167
+ for inconsistencies, expressed via `` max_duplicate_fraction`` . The latter
168
168
suggests that the number of uniques from said columns is larger or equal
169
- to ( 1 - max_duplicate_fraction) the number of rows.
169
+ to `` 1 - max_duplicate_fraction`` times the number of rows.
170
170
171
- If infer_pk_columns is True, columns will be retrieved from the primary keys.
172
- When columns= None and infer_pk_columns= False, the fallback is validating that all
173
- rows in a table are unique.
171
+ If `` infer_pk_columns`` is `` True``, `` columns`` will be retrieved from the primary keys.
172
+ If `` columns`` is `` None`` and ``infer_pk_column`` is `` False`` , the fallback is
173
+ validating that all rows in a table are unique.
174
174
"""
175
175
ref = DataReference (self .data_source , columns , condition )
176
176
self ._constraints .append (
@@ -194,9 +194,9 @@ def add_column_type_constraint(
194
194
"""
195
195
Check if a column type matches the expected column_type.
196
196
197
- The column_type can be provided as a string (backend-specific type name), a backend-specific SQLAlchemy type, or a SQLAlchemy's generic type.
197
+ The `` column_type`` can be provided as a string (backend-specific type name), a backend-specific SQLAlchemy type, or a SQLAlchemy's generic type.
198
198
199
- If SQLAlchemy's generic types are used, the check is performed using `isinstance`, which means that the actual type can also be a subclass of the target type.
199
+ If SQLAlchemy's generic types are used, the check is performed using `` isinstance` `, which means that the actual type can also be a subclass of the target type.
200
200
For more information on SQLAlchemy's generic types, see https://docs.sqlalchemy.org/en/20/core/type_basics.html
201
201
202
202
Parameters
@@ -319,7 +319,7 @@ def add_uniques_equality_constraint(
319
319
specified via the ``uniques`` parameter.
320
320
321
321
Null values in the columns ``columns`` are ignored. To assert the non-existence of them use
322
- the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint`` helper method
322
+ the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint` helper method
323
323
for ``WithinRequirement``.
324
324
By default, the null filtering does not trigger if multiple columns are fetched at once.
325
325
It can be configured in more detail by supplying a custom ``filter_func`` function.
@@ -372,7 +372,7 @@ def add_uniques_superset_constraint(
372
372
specified via ``uniques``, is contained in given columns of a ``DataSource``.
373
373
374
374
Null values in the columns ``columns`` are ignored. To assert the non-existence of them use
375
- the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint`` helper method
375
+ the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint` helper method
376
376
for ``WithinRequirement``.
377
377
By default, the null filtering does not trigger if multiple columns are fetched at once.
378
378
It can be configured in more detail by supplying a custom ``filter_func`` function.
@@ -435,7 +435,7 @@ def add_uniques_subset_constraint(
435
435
``uniques``.
436
436
437
437
Null values in the columns ``columns`` are ignored. To assert the non-existence of them use
438
- the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint`` helper method
438
+ the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint` helper method
439
439
for ``WithinRequirement``.
440
440
By default, the null filtering does not trigger if multiple columns are fetched at once.
441
441
It can be configured in more detail by supplying a custom ``filter_func`` function.
@@ -508,9 +508,9 @@ def add_categorical_bound_constraint(
508
508
Check if the distribution of unique values in columns falls within the
509
509
specified minimum and maximum bounds.
510
510
511
- The `CategoricalBoundConstraint` is added to ensure the distribution of unique values
512
- in the specified columns of a `DataSource` falls within the given minimum and maximum
513
- bounds defined in the `distribution` parameter.
511
+ The `` CategoricalBoundConstraint` ` is added to ensure the distribution of unique values
512
+ in the specified columns of a `` DataSource` ` falls within the given minimum and maximum
513
+ bounds defined in the `` distribution` ` parameter.
514
514
515
515
Parameters
516
516
----------
@@ -571,7 +571,7 @@ def add_numeric_min_constraint(
571
571
condition : Condition | None = None ,
572
572
cache_size = None ,
573
573
) -> None :
574
- """All values in column are greater or equal min_value."""
574
+ """All values in `` column`` are greater or equal `` min_value`` ."""
575
575
ref = DataReference (self .data_source , [column ], condition )
576
576
self ._constraints .append (
577
577
numeric_constraints .NumericMin (
@@ -587,7 +587,7 @@ def add_numeric_max_constraint(
587
587
name : str | None = None ,
588
588
cache_size = None ,
589
589
) -> None :
590
- """All values in column are less or equal max_value."""
590
+ """All values in `` column`` are less or equal `` max_value`` ."""
591
591
ref = DataReference (self .data_source , [column ], condition )
592
592
self ._constraints .append (
593
593
numeric_constraints .NumericMax (
@@ -634,7 +634,7 @@ def add_numeric_mean_constraint(
634
634
name : str | None = None ,
635
635
cache_size = None ,
636
636
) -> None :
637
- """Assert the mean of the column deviates at most max_deviation from mean_value."""
637
+ """Assert the mean of the column ``column`` deviates at most `` max_deviation`` from `` mean_value`` ."""
638
638
ref = DataReference (self .data_source , [column ], condition )
639
639
self ._constraints .append (
640
640
numeric_constraints .NumericMean (
@@ -695,9 +695,9 @@ def add_date_min_constraint(
695
695
name : str | None = None ,
696
696
cache_size = None ,
697
697
) -> None :
698
- """Ensure all dates to be superior than min_value.
698
+ """Ensure all dates to be superior than `` min_value`` .
699
699
700
- Use string format: min_value="'20121230'".
700
+ Use string format: `` min_value="'20121230'"`` .
701
701
702
702
For more information on ``column_type`` values, see ``add_column_type_constraint``.
703
703
@@ -728,16 +728,15 @@ def add_date_max_constraint(
728
728
name : str | None = None ,
729
729
cache_size = None ,
730
730
) -> None :
731
- """Ensure all dates to be superior than max_value.
731
+ """Ensure all dates to be superior than `` max_value`` .
732
732
733
- Use string format: max_value="'20121230'".
733
+ Use string format: `` max_value="'20121230'"``
734
734
735
- For more information on ``column_type`` values, see `` add_column_type_constraint` `.
735
+ For more information on ``column_type`` values, see :meth:`~datajudge.requirements.WithinRequirement. add_column_type_constraint`.
736
736
737
- If ``use_upper_bound_reference``, the max of the first table has to be
738
- smaller or equal to ``max_value``.
739
- If not ``use_upper_bound_reference``, the max of the first table has to
740
- be greater or equal to ``max_value``.
737
+ If ``use_upper_bound_reference`` is ``True``, the maximum date in ``column`` has to be smaller or
738
+ equal to ``max_value``. Otherwise the maximum date in ``column`` has to be greater or equal
739
+ to ``max_value``.
741
740
"""
742
741
ref = DataReference (self .data_source , [column ], condition )
743
742
self ._constraints .append (
@@ -761,7 +760,7 @@ def add_date_between_constraint(
761
760
name : str | None = None ,
762
761
cache_size = None ,
763
762
) -> None :
764
- """Use string format: lower_bound="'20121230'"."""
763
+ """Use string format: `` lower_bound="'20121230'"`` ."""
765
764
ref = DataReference (self .data_source , [column ], condition )
766
765
self ._constraints .append (
767
766
date_constraints .DateBetween (
@@ -935,7 +934,7 @@ def add_date_no_gap_constraint(
935
934
interest. A priori, a key is not a primary key, i.e., a key can have and often has
936
935
several rows. Thereby, a key will often come with several date ranges.
937
936
938
- If`` key_columns`` is ``None`` or ``[]``, all columns of the table will be
937
+ If `` key_columns`` is ``None`` or ``[]``, all columns of the table will be
939
938
considered as composing the key.
940
939
941
940
In order to express a tolerance for some violations of this gap property, use the
@@ -973,12 +972,12 @@ def add_functional_dependency_constraint(
973
972
cache_size = None ,
974
973
):
975
974
"""
976
- Expresses a functional dependency, a constraint where the `value_columns` are uniquely determined by the `key_columns`.
977
- This means that for each unique combination of values in the `key_columns`, there is exactly one corresponding combination of values in the `value_columns`.
975
+ Expresses a functional dependency, a constraint where the `` value_columns`` are uniquely determined by the `` key_columns` `.
976
+ This means that for each unique combination of values in the `` key_columns`` , there is exactly one corresponding combination of values in the `` value_columns` `.
978
977
979
- The ``add_unique_constraint`` constraint is a special case of this constraint, where the `key_columns` are a primary key,
980
- and all other columns are included `value_columns`.
981
- This constraint allows for a more general definition of functional dependencies, where the `key_columns` are not necessarily a primary key.
978
+ The ``add_unique_constraint`` constraint is a special case of this constraint, where the `` key_columns` ` are a primary key,
979
+ and all other columns are included `` value_columns` `.
980
+ This constraint allows for a more general definition of functional dependencies, where the `` key_columns` ` are not necessarily a primary key.
982
981
983
982
An additional configuration option (for details see the analogous parameter in for ``Uniques``-constraints)
984
983
on how the output is sorted and how many counterexamples are shown is available as ``output_processors``.
@@ -1027,7 +1026,7 @@ def add_numeric_no_gap_constraint(
1027
1026
interest. A priori, a key is not a primary key, i.e., a key can have and often has
1028
1027
several rows. Thereby, a key will often come with several intervals.
1029
1028
1030
- If`` key_columns`` is ``None`` or ``[]``, all columns of the table will be
1029
+ If `` key_columns`` is ``None`` or ``[]``, all columns of the table will be
1031
1030
considered as composing the key.
1032
1031
1033
1032
In order to express a tolerance for some violations of this gap property, use the
@@ -1648,7 +1647,7 @@ def add_uniques_equality_constraint(
1648
1647
columns.
1649
1648
1650
1649
Null values in the columns ``columns`` are ignored. To assert the non-existence of them use
1651
- the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint`` helper method
1650
+ the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint` helper method
1652
1651
for ``WithinRequirement``.
1653
1652
By default, the null filtering does not trigger if multiple columns are fetched at once.
1654
1653
It can be configured in more detail by supplying a custom ``filter_func`` function.
@@ -1704,7 +1703,7 @@ def add_uniques_superset_constraint(
1704
1703
is contained in given columns of a ``DataSource``.
1705
1704
1706
1705
Null values in the columns ``columns`` are ignored. To assert the non-existence of them use
1707
- the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint`` helper method
1706
+ the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint` helper method
1708
1707
for ``WithinRequirement``.
1709
1708
By default, the null filtering does not trigger if multiple columns are fetched at once.
1710
1709
It can be configured in more detail by supplying a custom ``filter_func`` function.
@@ -1769,7 +1768,7 @@ def add_uniques_subset_constraint(
1769
1768
``DataSource``.
1770
1769
1771
1770
Null values in the columns ``columns`` are ignored. To assert the non-existence of them use
1772
- the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint`` helper method
1771
+ the :meth:`~datajudge.requirements.WithinRequirement.add_null_absence_constraint` helper method
1773
1772
for ``WithinRequirement``.
1774
1773
By default, the null filtering does not trigger if multiple columns are fetched at once.
1775
1774
It can be configured in more detail by supplying a custom ``filter_func`` function.
0 commit comments