snowpark-checkpoints-validators 0.1.0rc3__tar.gz → 0.1.1__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 (55) hide show
  1. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/PKG-INFO +4 -6
  2. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/README.md +1 -3
  3. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/pyproject.toml +11 -4
  4. snowpark_checkpoints_validators-0.1.1/src/snowflake/snowpark_checkpoints/__init__.py +34 -0
  5. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/checkpoint.py +14 -3
  6. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/errors.py +14 -3
  7. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/job_context.py +14 -3
  8. snowpark_checkpoints_validators-0.1.1/src/snowflake/snowpark_checkpoints/singleton.py +23 -0
  9. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/snowpark_sampler.py +14 -3
  10. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/spark_migration.py +14 -3
  11. snowpark_checkpoints_validators-0.1.1/src/snowflake/snowpark_checkpoints/utils/__init__.py +14 -0
  12. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/utils/checkpoint_logger.py +14 -3
  13. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/utils/constants.py +14 -3
  14. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/utils/extra_config.py +14 -3
  15. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/utils/supported_types.py +14 -3
  16. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/utils/telemetry.py +35 -24
  17. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/utils/utils_checks.py +14 -3
  18. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/validation_result_metadata.py +14 -3
  19. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/validation_results.py +14 -3
  20. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/e2eexample.py +14 -3
  21. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_compare_utils.py +14 -3
  22. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/test_pandera.py +14 -3
  23. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/test_spark_checkpoint.py +14 -3
  24. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/unit/test_extra_config.py +14 -3
  25. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/unit/test_spark_migration.py +14 -3
  26. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/unit/test_telemetry.py +156 -71
  27. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/unit/test_utils_checks.py +14 -3
  28. snowpark_checkpoints_validators-0.1.0rc3/src/snowflake/snowpark_checkpoints/__init__.py +0 -23
  29. snowpark_checkpoints_validators-0.1.0rc3/src/snowflake/snowpark_checkpoints/singleton.py +0 -12
  30. snowpark_checkpoints_validators-0.1.0rc3/src/snowflake/snowpark_checkpoints/utils/__init__.py +0 -3
  31. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/.gitignore +0 -0
  32. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/CHANGELOG.md +0 -0
  33. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/LICENSE +0 -0
  34. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/src/snowflake/snowpark_checkpoints/utils/pandera_check_manager.py +0 -0
  35. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/.coveragerc +0 -0
  36. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/df_mode_dataframe_mismatch_telemetry.json +0 -0
  37. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/df_mode_dataframe_telemetry.json +0 -0
  38. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/spark_checkpoint_df_fail_telemetry.json +0 -0
  39. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/spark_checkpoint_df_pass_telemetry.json +0 -0
  40. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/spark_checkpoint_limit_sample_telemetry.json +0 -0
  41. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/spark_checkpoint_random_sample_telemetry.json +0 -0
  42. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/spark_checkpoint_scalar_fail_telemetry.json +0 -0
  43. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/spark_checkpoint_scalar_passing_telemetry.json +0 -0
  44. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/test_df_check_custom_check_telemetry.json +0 -0
  45. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/test_df_check_fail_telemetry.json +0 -0
  46. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/test_df_check_from_file_telemetry.json +0 -0
  47. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/test_df_check_skip_check_telemetry.json +0 -0
  48. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/test_df_check_telemetry.json +0 -0
  49. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/test_input_fail_telemetry.json +0 -0
  50. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/test_input_telemetry.json +0 -0
  51. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/test_output_fail_telemetry.json +0 -0
  52. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/telemetry_expected/test_output_telemetry.json +0 -0
  53. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/integ/test_parquet.py +0 -0
  54. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/test/unit/test_pandera_check_manager.py +0 -0
  55. {snowpark_checkpoints_validators-0.1.0rc3 → snowpark_checkpoints_validators-0.1.1}/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.1.0rc3
3
+ Version: 0.1.1
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,8 +29,8 @@ 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
33
- Requires-Dist: snowflake-snowpark-python
32
+ Requires-Dist: snowflake-connector-python==3.13.0
33
+ Requires-Dist: snowflake-snowpark-python==1.26.0
34
34
  Provides-Extra: development
35
35
  Requires-Dist: coverage>=7.6.7; extra == 'development'
36
36
  Requires-Dist: deepdiff>=8.0.0; extra == 'development'
@@ -47,9 +47,7 @@ Description-Content-Type: text/markdown
47
47
 
48
48
  ---
49
49
  **NOTE**
50
-
51
- This package is on Private Preview.
52
-
50
+ This package is on Public Preview.
53
51
  ---
54
52
 
55
53
  **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.
@@ -2,9 +2,7 @@
2
2
 
3
3
  ---
4
4
  **NOTE**
5
-
6
- This package is on Private Preview.
7
-
5
+ This package is on Public Preview.
8
6
  ---
9
7
 
10
8
  **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.
@@ -26,8 +26,8 @@ classifiers = [
26
26
  "Topic :: Scientific/Engineering :: Information Analysis",
27
27
  ]
28
28
  dependencies = [
29
- "snowflake-snowpark-python",
30
- "snowflake-connector-python",
29
+ "snowflake-snowpark-python==1.26.0",
30
+ "snowflake-connector-python==3.13.0",
31
31
  "pyspark",
32
32
  "pandera[io]==0.20.4",
33
33
  "pandera-report==0.1.2",
@@ -77,15 +77,22 @@ where = ["src/"]
77
77
  dev-mode-dirs = ['src']
78
78
  directory = 'snowpark-checkpoints-validators'
79
79
 
80
+ [[tool.hatch.sources]]
81
+ dir = "src/snowflake/snowpark_checkpoints"
82
+ name = "snowpark-checkpoints-validators"
83
+ type = "package"
84
+
80
85
  [tool.hatch.build.targets.wheel]
81
86
  directory = "dist"
82
- packages = ["snowpark-checkpoints-validators/src/snowflake/snowpark_checkpoints"]
87
+ packages = [
88
+ "src/snowflake",
89
+ ]
83
90
 
84
91
  [tool.hatch.build.targets.sdist]
85
92
  directory = "dist"
86
93
  exclude = ["/.github", "/.idea"]
87
94
  include = [
88
- 'src/',
95
+ 'src/**',
89
96
  'README.md',
90
97
  'LICENSE',
91
98
  'test/',
@@ -0,0 +1,34 @@
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 snowflake.snowpark_checkpoints.checkpoint import (
17
+ check_dataframe_schema,
18
+ check_output_schema,
19
+ check_input_schema,
20
+ validate_dataframe_checkpoint,
21
+ )
22
+ from snowflake.snowpark_checkpoints.job_context import SnowparkJobContext
23
+ from snowflake.snowpark_checkpoints.spark_migration import check_with_spark
24
+ from snowflake.snowpark_checkpoints.utils.constants import CheckpointMode
25
+
26
+ __all__ = [
27
+ "check_with_spark",
28
+ "SnowparkJobContext",
29
+ "check_dataframe_schema",
30
+ "check_output_schema",
31
+ "check_input_schema",
32
+ "validate_dataframe_checkpoint",
33
+ "CheckpointMode",
34
+ ]
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  # Wrapper around pandera which logs to snowflake
6
17
  from typing import Any, Optional, Union
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  from typing import Optional
6
17
 
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  from datetime import datetime
6
17
  from typing import Optional
@@ -0,0 +1,23 @@
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
+
17
+ class Singleton(type):
18
+ _instances = {}
19
+
20
+ def __call__(cls, *args, **kwargs):
21
+ if cls not in cls._instances:
22
+ cls._instances[cls] = super().__call__(*args, **kwargs)
23
+ return cls._instances[cls]
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  from typing import Optional
6
17
 
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
  from typing import Callable, Optional, TypeVar
5
16
 
6
17
  import pandas as pd
@@ -0,0 +1,14 @@
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.
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  import logging
6
17
  import threading
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  # Skip type
6
17
  from enum import IntEnum
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  import os
6
17
 
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  from snowflake.snowpark_checkpoints.utils.constants import (
6
17
  BINARY_TYPE,
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  import atexit
6
17
  import datetime
@@ -54,7 +65,9 @@ VERSION_FILE_NAME = "__version__.py"
54
65
 
55
66
 
56
67
  class TelemetryManager(TelemetryClient):
57
- def __init__(self, rest: SnowflakeRestful):
68
+ def __init__(
69
+ self, rest: Optional[SnowflakeRestful] = None, is_telemetry_enabled: bool = True
70
+ ):
58
71
  """TelemetryManager class to log telemetry events."""
59
72
  super().__init__(rest)
60
73
  self.sc_folder_path = (
@@ -62,14 +75,15 @@ class TelemetryManager(TelemetryClient):
62
75
  )
63
76
  self.sc_sf_path_telemetry = "/telemetry/send"
64
77
  self.sc_flush_size = 25
65
- self.sc_is_enabled = self._sc_is_telemetry_enabled()
78
+ self.sc_is_enabled = is_telemetry_enabled
66
79
  self.sc_is_testing = self._sc_is_telemetry_testing()
67
80
  self.sc_memory_limit = 5 * 1024 * 1024
68
81
  self._sc_upload_local_telemetry()
69
82
  self.sc_log_batch = []
70
83
  self.sc_hypothesis_input_events = []
71
84
  self.sc_version = _get_version()
72
- atexit.register(self._sc_close_at_exit)
85
+ if rest:
86
+ atexit.register(self._sc_close_at_exit)
73
87
 
74
88
  def set_sc_output_path(self, path: Path) -> None:
75
89
  """Set the output path for testing.
@@ -221,7 +235,7 @@ class TelemetryManager(TelemetryClient):
221
235
 
222
236
  def _sc_upload_local_telemetry(self) -> None:
223
237
  """Send a request to the API to upload the local telemetry events."""
224
- if not self.is_enabled() or self.sc_is_testing:
238
+ if not self.sc_is_enabled or self.sc_is_testing or not self._rest:
225
239
  return
226
240
  batch = []
227
241
  for file in self.sc_folder_path.glob("*.json"):
@@ -242,19 +256,6 @@ class TelemetryManager(TelemetryClient):
242
256
  for file in self.sc_folder_path.glob("*.json"):
243
257
  file.unlink()
244
258
 
245
- def _sc_is_telemetry_enabled(self) -> bool:
246
- """Check if telemetry is enabled.
247
-
248
- Returns:
249
- bool: True if telemetry is enabled, False otherwise.
250
-
251
- """
252
- if self._sc_is_telemetry_testing():
253
- return True
254
- if os.getenv("SNOWPARK_CHECKPOINTS_TELEMETRY_ENABLED") == "false":
255
- return False
256
- return self._rest is not None
257
-
258
259
  def _sc_is_telemetry_testing(self) -> bool:
259
260
  is_testing = os.getenv("SNOWPARK_CHECKPOINTS_TELEMETRY_TESTING") == "true"
260
261
  if is_testing:
@@ -262,6 +263,7 @@ class TelemetryManager(TelemetryClient):
262
263
  Path(os.getcwd()) / "snowpark-checkpoints-output" / "telemetry"
263
264
  )
264
265
  self.set_sc_output_path(local_telemetry_path)
266
+ self.sc_is_enabled = True
265
267
  return is_testing
266
268
 
267
269
  def _sc_is_telemetry_manager(self) -> bool:
@@ -427,10 +429,17 @@ def get_telemetry_manager() -> TelemetryManager:
427
429
  TelemetryManager: The telemetry manager.
428
430
 
429
431
  """
430
- connection = Session.builder.getOrCreate().connection
431
- if not hasattr(connection._telemetry, "_sc_is_telemetry_manager"):
432
- connection._telemetry = TelemetryManager(connection._rest)
433
- return connection._telemetry
432
+ try:
433
+ connection = Session.builder.getOrCreate().connection
434
+ if not hasattr(connection._telemetry, "_sc_is_telemetry_manager"):
435
+ connection._telemetry = TelemetryManager(
436
+ connection._rest, connection.telemetry_enabled
437
+ )
438
+ return connection._telemetry
439
+ except Exception:
440
+ telemetry_manager = TelemetryManager(None, is_telemetry_enabled=True)
441
+ telemetry_manager.sc_flush_size = 1
442
+ return telemetry_manager
434
443
 
435
444
 
436
445
  def get_snowflake_schema_types(df: snowpark_dataframe.DataFrame) -> list[str]:
@@ -826,6 +835,8 @@ def report_telemetry(
826
835
  except Exception as err:
827
836
  func_exception = err
828
837
 
838
+ if os.getenv("SNOWPARK_CHECKPOINTS_TELEMETRY_ENABLED") == "false":
839
+ return result
829
840
  telemetry_event = None
830
841
  data = None
831
842
  telemetry_m = None
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  import inspect
6
17
  import json
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  import os
6
17
 
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
 
6
17
  from pydantic import BaseModel
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  from pandera import DataFrameSchema, Column, Check
6
17
  from snowflake.snowpark import DataFrame as SnowparkDataFrame
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  import os
6
17
  import json
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  import json
6
17
  import os
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  from snowflake.snowpark_checkpoints.job_context import SnowparkJobContext
6
17
  from snowflake.snowpark_checkpoints.spark_migration import check_with_spark
@@ -1,6 +1,17 @@
1
- #
2
- # Copyright (c) 2012-2024 Snowflake Computing Inc. All rights reserved.
3
- #
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.
4
15
 
5
16
  import os
6
17
  from unittest.mock import MagicMock, patch