snowpark-checkpoints-validators 0.1.1__tar.gz → 0.1.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.
Files changed (53) hide show
  1. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/.gitignore +1 -0
  2. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/PKG-INFO +3 -4
  3. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/README.md +1 -2
  4. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/pyproject.toml +3 -2
  5. snowpark_checkpoints_validators-0.1.2/src/snowflake/snowpark_checkpoints/__version__.py +16 -0
  6. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/utils/telemetry.py +1 -1
  7. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/utils/utils_checks.py +2 -0
  8. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/validation_result_metadata.py +9 -0
  9. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/unit/test_validation_result_metadata.py +41 -0
  10. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/CHANGELOG.md +0 -0
  11. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/LICENSE +0 -0
  12. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/__init__.py +0 -0
  13. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/checkpoint.py +0 -0
  14. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/errors.py +0 -0
  15. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/job_context.py +0 -0
  16. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/singleton.py +0 -0
  17. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/snowpark_sampler.py +0 -0
  18. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/spark_migration.py +0 -0
  19. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/utils/__init__.py +0 -0
  20. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/utils/checkpoint_logger.py +0 -0
  21. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/utils/constants.py +0 -0
  22. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/utils/extra_config.py +0 -0
  23. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/utils/pandera_check_manager.py +0 -0
  24. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/utils/supported_types.py +0 -0
  25. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/src/snowflake/snowpark_checkpoints/validation_results.py +0 -0
  26. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/.coveragerc +0 -0
  27. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/e2eexample.py +0 -0
  28. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_compare_utils.py +0 -0
  29. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/df_mode_dataframe_mismatch_telemetry.json +0 -0
  30. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/df_mode_dataframe_telemetry.json +0 -0
  31. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/spark_checkpoint_df_fail_telemetry.json +0 -0
  32. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/spark_checkpoint_df_pass_telemetry.json +0 -0
  33. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/spark_checkpoint_limit_sample_telemetry.json +0 -0
  34. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/spark_checkpoint_random_sample_telemetry.json +0 -0
  35. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/spark_checkpoint_scalar_fail_telemetry.json +0 -0
  36. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/spark_checkpoint_scalar_passing_telemetry.json +0 -0
  37. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/test_df_check_custom_check_telemetry.json +0 -0
  38. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/test_df_check_fail_telemetry.json +0 -0
  39. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/test_df_check_from_file_telemetry.json +0 -0
  40. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/test_df_check_skip_check_telemetry.json +0 -0
  41. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/test_df_check_telemetry.json +0 -0
  42. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/test_input_fail_telemetry.json +0 -0
  43. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/test_input_telemetry.json +0 -0
  44. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/test_output_fail_telemetry.json +0 -0
  45. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/telemetry_expected/test_output_telemetry.json +0 -0
  46. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/test_pandera.py +0 -0
  47. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/test_parquet.py +0 -0
  48. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/integ/test_spark_checkpoint.py +0 -0
  49. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/unit/test_extra_config.py +0 -0
  50. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/unit/test_pandera_check_manager.py +0 -0
  51. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/unit/test_spark_migration.py +0 -0
  52. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/unit/test_telemetry.py +0 -0
  53. {snowpark_checkpoints_validators-0.1.1 → snowpark_checkpoints_validators-0.1.2}/test/unit/test_utils_checks.py +0 -0
@@ -13,6 +13,7 @@ wheelvenv/
13
13
 
14
14
  # version
15
15
  !__version__.py
16
+ !**/__version__.py
16
17
 
17
18
  #ruff
18
19
  .ruff_cache
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: snowpark-checkpoints-validators
3
- Version: 0.1.1
3
+ Version: 0.1.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/
@@ -29,7 +29,7 @@ Requires-Python: <3.12,>=3.9
29
29
  Requires-Dist: pandera-report==0.1.2
30
30
  Requires-Dist: pandera[io]==0.20.4
31
31
  Requires-Dist: pyspark
32
- Requires-Dist: snowflake-connector-python==3.13.0
32
+ Requires-Dist: snowflake-connector-python[pandas]
33
33
  Requires-Dist: snowflake-snowpark-python==1.26.0
34
34
  Provides-Extra: development
35
35
  Requires-Dist: coverage>=7.6.7; extra == 'development'
@@ -46,8 +46,7 @@ Description-Content-Type: text/markdown
46
46
  # snowpark-checkpoints-validators
47
47
 
48
48
  ---
49
- **NOTE**
50
- This package is on Public Preview.
49
+ ##### This package is on Public Preview.
51
50
  ---
52
51
 
53
52
  **snowpark-checkpoints-validators** is a package designed to validate Snowpark DataFrames against predefined schemas and checkpoints. This package ensures data integrity and consistency by performing schema and data validation checks at various stages of a Snowpark pipeline.
@@ -1,8 +1,7 @@
1
1
  # snowpark-checkpoints-validators
2
2
 
3
3
  ---
4
- **NOTE**
5
- This package is on Public Preview.
4
+ ##### This package is on Public Preview.
6
5
  ---
7
6
 
8
7
  **snowpark-checkpoints-validators** is a package designed to validate Snowpark DataFrames against predefined schemas and checkpoints. This package ensures data integrity and consistency by performing schema and data validation checks at various stages of a Snowpark pipeline.
@@ -27,7 +27,7 @@ classifiers = [
27
27
  ]
28
28
  dependencies = [
29
29
  "snowflake-snowpark-python==1.26.0",
30
- "snowflake-connector-python==3.13.0",
30
+ "snowflake-connector-python[pandas]",
31
31
  "pyspark",
32
32
  "pandera[io]==0.20.4",
33
33
  "pandera-report==0.1.2",
@@ -64,8 +64,9 @@ development = [
64
64
  "Bug Tracker" = "https://github.com/snowflakedb/snowpark-checkpoints/issues"
65
65
  "Source code" = "https://github.com/snowflakedb/snowpark-checkpoints/"
66
66
 
67
+
67
68
  [tool.hatch.version]
68
- path = "__version__.py"
69
+ path = "src/snowflake/snowpark_checkpoints/__version__.py"
69
70
  pattern = '^__version__ = "(?P<version>.*)"'
70
71
  source = "regex"
71
72
 
@@ -0,0 +1,16 @@
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
+ __version__ = "0.1.2"
@@ -367,7 +367,7 @@ def _get_version() -> str:
367
367
 
368
368
  """
369
369
  try:
370
- directory_levels_up = 4
370
+ directory_levels_up = 1
371
371
  project_root = Path(__file__).resolve().parents[directory_levels_up]
372
372
  version_file_path = project_root / VERSION_FILE_NAME
373
373
  with open(version_file_path) as file:
@@ -359,6 +359,8 @@ def _update_validation_result(
359
359
 
360
360
  pipeline_result_metadata = ValidationResultsMetadata(output_path)
361
361
 
362
+ pipeline_result_metadata.clean()
363
+
362
364
  pipeline_result_metadata.add_validation_result(
363
365
  ValidationResult(
364
366
  timestamp=datetime.now().isoformat(),
@@ -88,6 +88,15 @@ class ValidationResultsMetadata(metaclass=Singleton):
88
88
  f"Error reading validation results file: {self.validation_results_file} \n {e}"
89
89
  ) from None
90
90
 
91
+ def clean(self):
92
+ """Clean the validation results list.
93
+
94
+ This method empties the validation results list.
95
+
96
+ """
97
+ if not os.path.exists(self.validation_results_file):
98
+ self.validation_results.results = []
99
+
91
100
  def add_validation_result(self, validation_result: ValidationResult):
92
101
  """Add a validation result to the pipeline result list.
93
102
 
@@ -127,3 +127,44 @@ def test_save_creates_directory():
127
127
  metadata.save()
128
128
 
129
129
  mock_makedirs.assert_called_once_with(metadata.validation_results_directory)
130
+
131
+
132
+ def test_clean_with_existing_file():
133
+ test_path = os.path.dirname(os.path.abspath(__file__))
134
+ result_path = os.path.join(
135
+ test_path,
136
+ SNOWPARK_CHECKPOINTS_OUTPUT_DIRECTORY_NAME,
137
+ VALIDATION_RESULTS_JSON_FILE_NAME,
138
+ )
139
+ with open(result_path) as file:
140
+ validation_result_json = file.read()
141
+ mock_validation_results = ValidationResults.model_validate_json(
142
+ validation_result_json
143
+ )
144
+
145
+ metadata = ValidationResultsMetadata(test_path)
146
+ metadata.validation_results = mock_validation_results
147
+
148
+ with patch("os.path.exists", return_value=True):
149
+ metadata.clean()
150
+
151
+ assert metadata.validation_results == mock_validation_results
152
+
153
+
154
+ def test_clean_with_no_file():
155
+ test_path = os.path.dirname(os.path.abspath(__file__))
156
+ metadata = ValidationResultsMetadata(test_path)
157
+
158
+ new_validation_result = ValidationResult(
159
+ timestamp="2021-01-01T00:00:00",
160
+ file="file2",
161
+ line_of_code=1,
162
+ result=PASS_STATUS,
163
+ checkpoint_name="checkpoint2",
164
+ )
165
+ metadata.add_validation_result(new_validation_result)
166
+
167
+ with patch("os.path.exists", return_value=False):
168
+ metadata.clean()
169
+
170
+ assert metadata.validation_results == ValidationResults(results=[])