snowpark-checkpoints-validators 0.3.0__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/PKG-INFO +34 -1
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/README.md +33 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/__init__.py +2 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/__version__.py +1 -1
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/checkpoint.py +46 -4
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/utils/constants.py +1 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/test_parquet.py +9 -7
- snowpark_checkpoints_validators-0.3.2/test/unit/test_checkpoints.py +78 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/test_utils_checks.py +10 -3
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/.gitignore +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/CHANGELOG.md +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/LICENSE +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/pyproject.toml +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/errors.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/io_utils/__init__.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/io_utils/io_default_strategy.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/io_utils/io_env_strategy.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/io_utils/io_file_manager.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/job_context.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/singleton.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/snowpark_sampler.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/spark_migration.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/utils/__init__.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/utils/extra_config.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/utils/logging_utils.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/utils/pandera_check_manager.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/utils/supported_types.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/utils/telemetry.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/utils/utils_checks.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/validation_result_metadata.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/src/snowflake/snowpark_checkpoints/validation_results.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/.coveragerc +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/e2eexample.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_compare_utils.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/df_mode_dataframe_mismatch_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/df_mode_dataframe_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/spark_checkpoint_df_fail_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/spark_checkpoint_df_pass_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/spark_checkpoint_limit_sample_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/spark_checkpoint_random_sample_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/spark_checkpoint_scalar_fail_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/spark_checkpoint_scalar_passing_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/test_df_check_custom_check_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/test_df_check_fail_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/test_df_check_from_file_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/test_df_check_skip_check_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/test_df_check_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/test_input_fail_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/test_input_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/test_output_fail_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/telemetry_expected/test_output_telemetry.json +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/test_pandera.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/integ/test_spark_checkpoint.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/io_utils/test_default_strategy.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/test_extra_config.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/test_job_context.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/test_logger.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/test_logging_utils.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/test_pandera_check_manager.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/test_spark_migration.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/test_telemetry.py +0 -0
- {snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/unit/test_validation_result_metadata.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: snowpark-checkpoints-validators
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.2
|
4
4
|
Summary: Migration tools for Snowpark
|
5
5
|
Project-URL: Bug Tracker, https://github.com/snowflakedb/snowpark-checkpoints/issues
|
6
6
|
Project-URL: Source code, https://github.com/snowflakedb/snowpark-checkpoints/
|
@@ -322,4 +322,37 @@ sp_dataframe = session.create_dataframe(df)
|
|
322
322
|
preprocessed_dataframe = preprocessor(sp_dataframe)
|
323
323
|
```
|
324
324
|
|
325
|
+
### Skip validation
|
326
|
+
The method `xvalidate_dataframe_checkpoint` can be used to avoid the validation of the checkpoint defined.
|
327
|
+
The result of the checkpoint will be `SKIP` and a message will be logged in the terminal. The method contains the same signature of `validate_dataframe_checkpoint`.
|
328
|
+
|
329
|
+
#### Usage Example
|
330
|
+
|
331
|
+
```python
|
332
|
+
from snowflake.snowpark import Session
|
333
|
+
from snowflake.snowpark_checkpoints.utils.constant import (
|
334
|
+
CheckpointMode,
|
335
|
+
)
|
336
|
+
from snowflake.snowpark_checkpoints.checkpoint import validate_dataframe_checkpoint
|
337
|
+
from snowflake.snowpark_checkpoints.spark_migration import SamplingStrategy
|
338
|
+
from snowflake.snowpark_checkpoints.job_context import SnowparkJobContext
|
339
|
+
from pyspark.sql import SparkSession
|
340
|
+
|
341
|
+
session = Session.builder.getOrCreate()
|
342
|
+
job_context = SnowparkJobContext(
|
343
|
+
session, SparkSession.builder.getOrCreate(), "job_context", True
|
344
|
+
)
|
345
|
+
df = session.read.format("csv").load("data.csv")
|
346
|
+
|
347
|
+
xvalidate_dataframe_checkpoint(
|
348
|
+
df,
|
349
|
+
"schema_checkpoint",
|
350
|
+
job_context=job_context,
|
351
|
+
mode=CheckpointMode.SCHEMA,
|
352
|
+
sample_frac=0.1,
|
353
|
+
sampling_strategy=SamplingStrategy.RANDOM_SAMPLE
|
354
|
+
)
|
355
|
+
```
|
356
|
+
|
357
|
+
|
325
358
|
------
|
@@ -273,4 +273,37 @@ sp_dataframe = session.create_dataframe(df)
|
|
273
273
|
preprocessed_dataframe = preprocessor(sp_dataframe)
|
274
274
|
```
|
275
275
|
|
276
|
+
### Skip validation
|
277
|
+
The method `xvalidate_dataframe_checkpoint` can be used to avoid the validation of the checkpoint defined.
|
278
|
+
The result of the checkpoint will be `SKIP` and a message will be logged in the terminal. The method contains the same signature of `validate_dataframe_checkpoint`.
|
279
|
+
|
280
|
+
#### Usage Example
|
281
|
+
|
282
|
+
```python
|
283
|
+
from snowflake.snowpark import Session
|
284
|
+
from snowflake.snowpark_checkpoints.utils.constant import (
|
285
|
+
CheckpointMode,
|
286
|
+
)
|
287
|
+
from snowflake.snowpark_checkpoints.checkpoint import validate_dataframe_checkpoint
|
288
|
+
from snowflake.snowpark_checkpoints.spark_migration import SamplingStrategy
|
289
|
+
from snowflake.snowpark_checkpoints.job_context import SnowparkJobContext
|
290
|
+
from pyspark.sql import SparkSession
|
291
|
+
|
292
|
+
session = Session.builder.getOrCreate()
|
293
|
+
job_context = SnowparkJobContext(
|
294
|
+
session, SparkSession.builder.getOrCreate(), "job_context", True
|
295
|
+
)
|
296
|
+
df = session.read.format("csv").load("data.csv")
|
297
|
+
|
298
|
+
xvalidate_dataframe_checkpoint(
|
299
|
+
df,
|
300
|
+
"schema_checkpoint",
|
301
|
+
job_context=job_context,
|
302
|
+
mode=CheckpointMode.SCHEMA,
|
303
|
+
sample_frac=0.1,
|
304
|
+
sampling_strategy=SamplingStrategy.RANDOM_SAMPLE
|
305
|
+
)
|
306
|
+
```
|
307
|
+
|
308
|
+
|
276
309
|
------
|
@@ -27,6 +27,7 @@ from snowflake.snowpark_checkpoints.checkpoint import (
|
|
27
27
|
check_input_schema,
|
28
28
|
check_output_schema,
|
29
29
|
validate_dataframe_checkpoint,
|
30
|
+
xvalidate_dataframe_checkpoint,
|
30
31
|
)
|
31
32
|
from snowflake.snowpark_checkpoints.job_context import SnowparkJobContext
|
32
33
|
from snowflake.snowpark_checkpoints.spark_migration import check_with_spark
|
@@ -39,6 +40,7 @@ __all__ = [
|
|
39
40
|
"check_dataframe_schema",
|
40
41
|
"check_output_schema",
|
41
42
|
"check_input_schema",
|
43
|
+
"xvalidate_dataframe_checkpoint",
|
42
44
|
"validate_dataframe_checkpoint",
|
43
45
|
"CheckpointMode",
|
44
46
|
]
|
@@ -33,6 +33,7 @@ from snowflake.snowpark_checkpoints.snowpark_sampler import (
|
|
33
33
|
from snowflake.snowpark_checkpoints.utils.constants import (
|
34
34
|
FAIL_STATUS,
|
35
35
|
PASS_STATUS,
|
36
|
+
SKIP_STATUS,
|
36
37
|
CheckpointMode,
|
37
38
|
)
|
38
39
|
from snowflake.snowpark_checkpoints.utils.extra_config import is_checkpoint_enabled
|
@@ -92,11 +93,10 @@ def validate_dataframe_checkpoint(
|
|
92
93
|
checkpoint_name = _replace_special_characters(checkpoint_name)
|
93
94
|
|
94
95
|
if not is_checkpoint_enabled(checkpoint_name):
|
95
|
-
|
96
|
-
"Checkpoint '
|
97
|
-
|
96
|
+
raise Exception(
|
97
|
+
f"Checkpoint '{checkpoint_name}' is disabled. Please enable it in the checkpoints.json file.",
|
98
|
+
"In case you want to skip it, use the xvalidate_dataframe_checkpoint method instead.",
|
98
99
|
)
|
99
|
-
return None
|
100
100
|
|
101
101
|
LOGGER.info(
|
102
102
|
"Starting DataFrame checkpoint validation for checkpoint '%s'", checkpoint_name
|
@@ -132,6 +132,48 @@ def validate_dataframe_checkpoint(
|
|
132
132
|
)
|
133
133
|
|
134
134
|
|
135
|
+
@log
|
136
|
+
def xvalidate_dataframe_checkpoint(
|
137
|
+
df: SnowparkDataFrame,
|
138
|
+
checkpoint_name: str,
|
139
|
+
job_context: Optional[SnowparkJobContext] = None,
|
140
|
+
mode: Optional[CheckpointMode] = CheckpointMode.SCHEMA,
|
141
|
+
custom_checks: Optional[dict[Any, Any]] = None,
|
142
|
+
skip_checks: Optional[dict[Any, Any]] = None,
|
143
|
+
sample_frac: Optional[float] = 1.0,
|
144
|
+
sample_number: Optional[int] = None,
|
145
|
+
sampling_strategy: Optional[SamplingStrategy] = SamplingStrategy.RANDOM_SAMPLE,
|
146
|
+
output_path: Optional[str] = None,
|
147
|
+
) -> Union[tuple[bool, PandasDataFrame], None]:
|
148
|
+
"""Skips the validation of a Snowpark DataFrame against a specified checkpoint.
|
149
|
+
|
150
|
+
Args:
|
151
|
+
df (SnowparkDataFrame): The DataFrame to validate.
|
152
|
+
checkpoint_name (str): The name of the checkpoint to validate against.
|
153
|
+
job_context (SnowparkJobContext, optional): The job context for the validation. Required for PARQUET mode.
|
154
|
+
mode (CheckpointMode): The mode of validation (e.g., SCHEMA, PARQUET). Defaults to SCHEMA.
|
155
|
+
custom_checks (Optional[dict[Any, Any]], optional): Custom checks to apply during validation.
|
156
|
+
skip_checks (Optional[dict[Any, Any]], optional): Checks to skip during validation.
|
157
|
+
sample_frac (Optional[float], optional): Fraction of the DataFrame to sample for validation. Defaults to 0.1.
|
158
|
+
sample_number (Optional[int], optional): Number of rows to sample for validation.
|
159
|
+
sampling_strategy (Optional[SamplingStrategy], optional): Strategy to use for sampling.
|
160
|
+
Defaults to RANDOM_SAMPLE.
|
161
|
+
output_path (Optional[str], optional): The output path for the validation results.
|
162
|
+
|
163
|
+
Raises:
|
164
|
+
ValueError: If an invalid validation mode is provided or if job_context is None for PARQUET mode.
|
165
|
+
|
166
|
+
"""
|
167
|
+
checkpoint_name = _replace_special_characters(checkpoint_name)
|
168
|
+
|
169
|
+
LOGGER.warning(
|
170
|
+
"Checkpoint '%s' is disabled. Skipping DataFrame checkpoint validation.",
|
171
|
+
checkpoint_name,
|
172
|
+
)
|
173
|
+
|
174
|
+
_update_validation_result(checkpoint_name, SKIP_STATUS, output_path)
|
175
|
+
|
176
|
+
|
135
177
|
def _check_dataframe_schema_file(
|
136
178
|
df: SnowparkDataFrame,
|
137
179
|
checkpoint_name: str,
|
@@ -408,15 +408,17 @@ def test_validate_dataframe_checkpoint_disabled_checkpoint(
|
|
408
408
|
):
|
409
409
|
mock_is_checkpoint_enabled.return_value = False
|
410
410
|
caplog.set_level(level=logging.WARNING, logger=LOGGER_NAME)
|
411
|
-
|
411
|
+
expected_exception_error_msg = "Checkpoint 'test_checkpoint' is disabled. Please enable it in the checkpoints.json file."
|
412
|
+
expected_fix_suggestion_msg = "In case you want to skip it, use the xvalidate_dataframe_checkpoint method instead."
|
412
413
|
df = MagicMock()
|
413
414
|
checkpoint_name = "test_checkpoint"
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
415
|
+
try:
|
416
|
+
validate_dataframe_checkpoint(df=df, checkpoint_name=checkpoint_name)
|
417
|
+
except Exception as error:
|
418
|
+
error_msg = error.args[0]
|
419
|
+
fix_suggestion_msg = error.args[1]
|
420
|
+
assert error_msg == expected_exception_error_msg
|
421
|
+
assert fix_suggestion_msg == expected_fix_suggestion_msg
|
420
422
|
|
421
423
|
|
422
424
|
def test_io_strategy(
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# Copyright 2025 Snowflake Inc.
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
3
|
+
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
|
16
|
+
from typing import get_type_hints
|
17
|
+
from unittest.mock import patch
|
18
|
+
|
19
|
+
from snowflake.snowpark_checkpoints.checkpoint import (
|
20
|
+
validate_dataframe_checkpoint,
|
21
|
+
xvalidate_dataframe_checkpoint,
|
22
|
+
)
|
23
|
+
from snowflake.snowpark_checkpoints.utils.constants import (
|
24
|
+
SKIP_STATUS,
|
25
|
+
)
|
26
|
+
from unittest.mock import MagicMock
|
27
|
+
from snowflake.snowpark_checkpoints.validation_result_metadata import (
|
28
|
+
ValidationResultsMetadata,
|
29
|
+
)
|
30
|
+
|
31
|
+
|
32
|
+
def test_xvalidate_dataframe_checkpoint():
|
33
|
+
checkpoint_name = "my_checkpoint"
|
34
|
+
module_name = "snowflake.snowpark_checkpoints.validation_result_metadata"
|
35
|
+
validation_results_metadata = ValidationResultsMetadata("some/dummy/path")
|
36
|
+
with (
|
37
|
+
patch(
|
38
|
+
f"{module_name}.ValidationResultsMetadata",
|
39
|
+
return_value=validation_results_metadata,
|
40
|
+
)
|
41
|
+
):
|
42
|
+
pyspark_df = MagicMock()
|
43
|
+
checkpoint_name = "my_checkpoint"
|
44
|
+
|
45
|
+
xvalidate_dataframe_checkpoint(pyspark_df, checkpoint_name)
|
46
|
+
|
47
|
+
validation_results = validation_results_metadata.validation_results
|
48
|
+
validation_results = validation_results.model_dump()
|
49
|
+
my_checkpoint_result = validation_results["results"][0]
|
50
|
+
|
51
|
+
assert my_checkpoint_result["checkpoint_name"] == checkpoint_name
|
52
|
+
assert my_checkpoint_result["result"] == SKIP_STATUS
|
53
|
+
|
54
|
+
|
55
|
+
def test_skip_validator_parameters_commutability():
|
56
|
+
validation_hints = get_type_hints(validate_dataframe_checkpoint)
|
57
|
+
x_validation_hints = get_type_hints(xvalidate_dataframe_checkpoint)
|
58
|
+
|
59
|
+
validate_params = {
|
60
|
+
name: hint for name, hint in validation_hints.items() if name != "return"
|
61
|
+
}
|
62
|
+
x_validate_params = {
|
63
|
+
name: hint for name, hint in x_validation_hints.items() if name != "return"
|
64
|
+
}
|
65
|
+
assert (
|
66
|
+
validate_params == x_validate_params
|
67
|
+
), "The parameters of validate_dataframe_checkpoint and xvalidate_dataframe_checkpoint must be the same."
|
68
|
+
|
69
|
+
|
70
|
+
def test_skip_validator_return_type_commutability():
|
71
|
+
validation_hints = get_type_hints(validate_dataframe_checkpoint)
|
72
|
+
x_validation_hints = get_type_hints(xvalidate_dataframe_checkpoint)
|
73
|
+
|
74
|
+
validate_return = validation_hints.get("return")
|
75
|
+
x_validate_return = x_validation_hints.get("return")
|
76
|
+
assert (
|
77
|
+
validate_return == x_validate_return
|
78
|
+
), "The return type of validate_dataframe_checkpoint and xvalidate_dataframe_checkpoint must be the same."
|
@@ -32,13 +32,10 @@ from snowflake.snowpark_checkpoints.utils.constants import (
|
|
32
32
|
FLOAT_TYPE,
|
33
33
|
MEAN_KEY,
|
34
34
|
NAME_KEY,
|
35
|
-
NULL_COUNT_KEY,
|
36
35
|
OVERWRITE_MODE,
|
37
36
|
PASS_STATUS,
|
38
|
-
ROWS_COUNT_KEY,
|
39
37
|
SNOWPARK_CHECKPOINTS_OUTPUT_DIRECTORY_NAME,
|
40
38
|
TYPE_KEY,
|
41
|
-
SKIP_ALL,
|
42
39
|
MARGIN_ERROR_KEY,
|
43
40
|
)
|
44
41
|
from pandera import Column, Check, DataFrameSchema
|
@@ -477,3 +474,13 @@ def test_replace_special_characters_valid(name, expected):
|
|
477
474
|
def test_replace_special_characters_invalid(name):
|
478
475
|
with raises(ValueError):
|
479
476
|
_replace_special_characters(name)
|
477
|
+
|
478
|
+
|
479
|
+
def test_invalid_xvalidate_import():
|
480
|
+
try:
|
481
|
+
from snowflake.snowpark_checkpoints import xvalidate_dataframe_checkpoint
|
482
|
+
except ImportError as e:
|
483
|
+
assert (
|
484
|
+
str(e)
|
485
|
+
== "xvalidate_dataframe_checkpoint is not available in the specified package."
|
486
|
+
)
|
File without changes
|
{snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/CHANGELOG.md
RENAMED
File without changes
|
File without changes
|
{snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/pyproject.toml
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{snowpark_checkpoints_validators-0.3.0 → snowpark_checkpoints_validators-0.3.2}/test/.coveragerc
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|