dcs-sdk 2.0.0__tar.gz → 2.1.0__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 (173) hide show
  1. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/PKG-INFO +2 -2
  2. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/README.md +1 -1
  3. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/errors.py +36 -0
  4. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/datasource/sql_datasource.py +60 -5
  5. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/mssql.py +113 -37
  6. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/__version__.py +1 -1
  7. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/pyproject.toml +1 -1
  8. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/__init__.py +0 -0
  9. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/__main__.py +0 -0
  10. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/abcs/__init__.py +0 -0
  11. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/abcs/compiler.py +0 -0
  12. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/abcs/database_types.py +0 -0
  13. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/config.py +0 -0
  14. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/__init__.py +0 -0
  15. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/_connect.py +0 -0
  16. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/base.py +0 -0
  17. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/bigquery.py +0 -0
  18. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/clickhouse.py +0 -0
  19. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/databricks.py +0 -0
  20. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/db2.py +0 -0
  21. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/duckdb.py +0 -0
  22. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/mssql.py +0 -0
  23. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/mysql.py +0 -0
  24. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/oracle.py +0 -0
  25. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/postgresql.py +0 -0
  26. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/presto.py +0 -0
  27. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/redis.py +0 -0
  28. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/redshift.py +0 -0
  29. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/sap_hana.py +0 -0
  30. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/snowflake.py +0 -0
  31. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/sybase.py +0 -0
  32. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/trino.py +0 -0
  33. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/databases/vertica.py +0 -0
  34. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/diff_tables.py +0 -0
  35. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/errors.py +0 -0
  36. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/format.py +0 -0
  37. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/hashdiff_tables.py +0 -0
  38. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/info_tree.py +0 -0
  39. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/joindiff_tables.py +0 -0
  40. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/lexicographic_space.py +0 -0
  41. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/parse_time.py +0 -0
  42. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/py.typed +0 -0
  43. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/queries/__init__.py +0 -0
  44. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/queries/api.py +0 -0
  45. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/queries/ast_classes.py +0 -0
  46. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/queries/base.py +0 -0
  47. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/queries/extras.py +0 -0
  48. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/query_utils.py +0 -0
  49. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/schema.py +0 -0
  50. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/streaming.py +0 -0
  51. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/table_segment.py +0 -0
  52. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/thread_utils.py +0 -0
  53. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/utils.py +0 -0
  54. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/data_diff/version.py +0 -0
  55. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/__init__.py +0 -0
  56. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/__main__.py +0 -0
  57. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/__version__.py +0 -0
  58. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/cli/__init__.py +0 -0
  59. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/cli/cli.py +0 -0
  60. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/__init__.py +0 -0
  61. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/__init__.py +0 -0
  62. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/models/__init__.py +0 -0
  63. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/models/configuration.py +0 -0
  64. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/models/dashboard.py +0 -0
  65. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/models/data_source_resource.py +0 -0
  66. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/models/metric.py +0 -0
  67. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/models/profile.py +0 -0
  68. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/models/validation.py +0 -0
  69. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/common/models/widget.py +0 -0
  70. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/configuration/__init__.py +0 -0
  71. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/configuration/config_loader.py +0 -0
  72. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/configuration/configuration_parser.py +0 -0
  73. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/configuration/configuration_parser_arc.py +0 -0
  74. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/datasource/__init__.py +0 -0
  75. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/datasource/base.py +0 -0
  76. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/datasource/file_datasource.py +0 -0
  77. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/datasource/manager.py +0 -0
  78. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/datasource/search_datasource.py +0 -0
  79. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/inspect.py +0 -0
  80. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/logger/__init__.py +0 -0
  81. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/logger/base.py +0 -0
  82. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/logger/default_logger.py +0 -0
  83. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/metric/__init__.py +0 -0
  84. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/metric/base.py +0 -0
  85. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/metric/combined_metric.py +0 -0
  86. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/metric/custom_metric.py +0 -0
  87. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/metric/manager.py +0 -0
  88. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/metric/numeric_metric.py +0 -0
  89. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/metric/reliability_metric.py +0 -0
  90. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/observability/__init__.py +0 -0
  91. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/observability/connection_observer.py +0 -0
  92. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/profiling/__init__.py +0 -0
  93. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/profiling/datasource_profiling.py +0 -0
  94. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/profiling/numeric_field_profiling.py +0 -0
  95. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/profiling/text_field_profiling.py +0 -0
  96. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/repository/__init__.py +0 -0
  97. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/repository/metric_repository.py +0 -0
  98. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/utils/__init__.py +0 -0
  99. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/utils/log.py +0 -0
  100. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/utils/tracking.py +0 -0
  101. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/utils/utils.py +0 -0
  102. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/validation/__init__.py +0 -0
  103. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/validation/base.py +0 -0
  104. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/validation/completeness_validation.py +0 -0
  105. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/validation/custom_query_validation.py +0 -0
  106. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/validation/manager.py +0 -0
  107. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/validation/numeric_validation.py +0 -0
  108. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/validation/reliability_validation.py +0 -0
  109. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/validation/uniqueness_validation.py +0 -0
  110. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/core/validation/validity_validation.py +0 -0
  111. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/__init__.py +0 -0
  112. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/__init__.py +0 -0
  113. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/azure_blob.py +0 -0
  114. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/bigquery.py +0 -0
  115. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/clickhouse.py +0 -0
  116. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/databricks.py +0 -0
  117. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/db2.py +0 -0
  118. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/duck_db.py +0 -0
  119. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/elasticsearch.py +0 -0
  120. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/mysql.py +0 -0
  121. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/opensearch.py +0 -0
  122. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/oracle.py +0 -0
  123. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/postgres.py +0 -0
  124. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/presto.py +0 -0
  125. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/redshift.py +0 -0
  126. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/sap_hana.py +0 -0
  127. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/snowflake.py +0 -0
  128. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/spark_df.py +0 -0
  129. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/sybase.py +0 -0
  130. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/trino.py +0 -0
  131. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/databases/vertica.py +0 -0
  132. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/storage/__init__.py +0 -0
  133. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/storage/local_file.py +0 -0
  134. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/utils/__init__.py +0 -0
  135. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/integrations/utils/utils.py +0 -0
  136. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/__init__.py +0 -0
  137. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/dashboard.py +0 -0
  138. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/models.py +0 -0
  139. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/assets/fonts/DMSans-Bold.ttf +0 -0
  140. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/assets/fonts/DMSans-Medium.ttf +0 -0
  141. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/assets/fonts/DMSans-Regular.ttf +0 -0
  142. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/assets/fonts/DMSans-SemiBold.ttf +0 -0
  143. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/assets/images/docs.svg +0 -0
  144. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/assets/images/github.svg +0 -0
  145. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/assets/images/logo.svg +0 -0
  146. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/assets/images/slack.svg +0 -0
  147. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/index.js +0 -0
  148. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_core/report/static/index.js.LICENSE.txt +0 -0
  149. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/__init__.py +0 -0
  150. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/__main__.py +0 -0
  151. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/cli/__init__.py +0 -0
  152. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/cli/cli.py +0 -0
  153. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/__init__.py +0 -0
  154. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/config/__init__.py +0 -0
  155. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/config/config_loader.py +0 -0
  156. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/data_diff/__init__.py +0 -0
  157. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/data_diff/data_differ.py +0 -0
  158. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/rules/__init__.py +0 -0
  159. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/rules/rules_mappping.py +0 -0
  160. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/rules/rules_repository.py +0 -0
  161. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/rules/schema_rules.py +0 -0
  162. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/__init__.py +0 -0
  163. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/serializer.py +0 -0
  164. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/similarity_score/__init__.py +0 -0
  165. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/similarity_score/base_provider.py +0 -0
  166. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/similarity_score/cosine_similarity_provider.py +0 -0
  167. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/similarity_score/jaccard_provider.py +0 -0
  168. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/similarity_score/levenshtein_distance_provider.py +0 -0
  169. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/table.py +0 -0
  170. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/themes.py +0 -0
  171. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/sdk/utils/utils.py +0 -0
  172. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/utils/__init__.py +0 -0
  173. {dcs_sdk-2.0.0 → dcs_sdk-2.1.0}/dcs_sdk/utils/temp_objects.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dcs-sdk
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: SDK for DataChecks
5
5
  Author: Waterdip Labs
6
6
  Author-email: hello@waterdip.ai
@@ -93,7 +93,7 @@ Requires-Dist: virtualenv (>=20.36.2,<21.0.0)
93
93
  Description-Content-Type: text/markdown
94
94
 
95
95
  <h1 align="center">
96
- DCS SDK v2.0.0
96
+ DCS SDK v2.1.0
97
97
  </h1>
98
98
 
99
99
  > SDK for DataChecks
@@ -1,5 +1,5 @@
1
1
  <h1 align="center">
2
- DCS SDK v2.0.0
2
+ DCS SDK v2.1.0
3
3
  </h1>
4
4
 
5
5
  > SDK for DataChecks
@@ -79,6 +79,42 @@ class DependencyParseError(Exception):
79
79
  self.sql_definition = sql_definition
80
80
 
81
81
 
82
+ class OdbcValueDecodeError(Exception):
83
+ """Raised when an ODBC output converter cannot decode a driver buffer.
84
+
85
+ Deliberately *not* swallowed. These converters exist because pyodbc cannot
86
+ fetch certain SQL Server extended types natively, so they sit between the
87
+ wire and every consumer of a value. A converter that answers a buffer it did
88
+ not understand with a plausible-looking substitute -- ``raw.hex()``, say --
89
+ does not fail, it *lies*: the fetch succeeds, the row looks populated, and a
90
+ wrong value travels into profiling, sampling, seeding and diffing with
91
+ nothing anywhere marking it as suspect. That is how a 12-byte
92
+ ``SQL_SS_TIME2_STRUCT`` unpacked with a 10-byte format spent its life
93
+ arriving as the 24-character string ``'000000000100000000000000'``.
94
+
95
+ A decode failure means the driver's layout is not the one we encode here,
96
+ which is a bug in this module or a driver change -- either way something a
97
+ human must look at, so it is raised with the evidence needed to fix it.
98
+
99
+ :param sql_type: the ODBC SQL type code, e.g. ``-154``.
100
+ :param type_name: its human name, e.g. ``"time"``.
101
+ :param reason: what specifically did not match.
102
+ :param raw: the buffer the driver handed over.
103
+ """
104
+
105
+ def __init__(self, sql_type: int, type_name: str, reason: str, raw=None):
106
+ hexdump = raw.hex() if isinstance(raw, (bytes, bytearray)) else repr(raw)
107
+ super().__init__(
108
+ f"Could not decode SQL Server {type_name} (ODBC SQL type {sql_type}): "
109
+ f"{reason}. Raw buffer ({len(raw) if isinstance(raw, (bytes, bytearray)) else '?'} bytes): {hexdump}"
110
+ )
111
+ self.error_code = "odbc_value_decode_error"
112
+ self.sql_type = sql_type
113
+ self.type_name = type_name
114
+ self.reason = reason
115
+ self.raw = raw
116
+
117
+
82
118
  class EstateSurfaceUnavailableError(Exception):
83
119
  """Raised when an estate surface could not be read, so a caller can tell
84
120
  "we looked and there is nothing" apart from "we could not look".
@@ -252,7 +252,29 @@ class SQLDataSource(DataSource):
252
252
  if isinstance(value, bool):
253
253
  return value
254
254
  if isinstance(value, Decimal):
255
- return float(value) if value.is_finite() else str(value)
255
+ # Kept as Decimal, deliberately.
256
+ #
257
+ # This used to be `float(value)`, which is lossy at exactly the
258
+ # place it hurts most: money. A float carries ~15-17 significant
259
+ # decimal digits, while SQL Server's DECIMAL(38,s), Oracle's NUMBER
260
+ # and Postgres' numeric carry up to 38. `Decimal("99999999999999.9999")`
261
+ # -- a perfectly ordinary DECIMAL(18,4) claim amount -- becomes
262
+ # `100000000000000.0`, and `Decimal("0.1") + Decimal("0.2")` stops
263
+ # equalling `Decimal("0.3")`.
264
+ #
265
+ # The failure mode is worse than the rounding. Both sides of a
266
+ # comparison are normalised by this same function, so two values
267
+ # that differ in the source can be flattened onto the same float and
268
+ # the diff then reports convergence on rows that do not match. A
269
+ # tool that exists to find differences must not erase them on the
270
+ # way in.
271
+ #
272
+ # Nothing downstream requires the float: no caller in this SDK
273
+ # JSON-serialises these rows, and the consumers that do (e.g.
274
+ # stormbreaker's `sanitize_for_json`) already handle Decimal
275
+ # themselves. `str(Decimal("0.0725"))` is also exactly "0.0725",
276
+ # where `str(0.0725)` is a float's best effort.
277
+ return value
256
278
  if isinstance(value, Fraction):
257
279
  return float(value)
258
280
  if isinstance(value, float):
@@ -274,10 +296,43 @@ class SQLDataSource(DataSource):
274
296
  if isinstance(value, memoryview):
275
297
  return self.normalize_sample_value(value.tobytes())
276
298
  if isinstance(value, (bytes, bytearray)):
277
- try:
278
- return value.decode("utf-8")
279
- except Exception:
280
- return value.hex()
299
+ # Always hex. One column, one representation.
300
+ #
301
+ # This used to try `decode("utf-8")` and fall back to `.hex()`, so
302
+ # the representation was chosen per VALUE rather than per COLUMN:
303
+ # within a single VARBINARY column, a row holding b"Hello" became
304
+ # the 5-character text "Hello" while the next row holding
305
+ # b"\xde\xad\xbe\xef" became the 8-character string "deadbeef".
306
+ # Same column, same type, two incompatible encodings — so string
307
+ # length, character profiling and any equality test on that column
308
+ # were measuring the accident of whether the bytes happened to be
309
+ # valid UTF-8.
310
+ #
311
+ # Hex is the only single behaviour that is both total (every byte
312
+ # sequence has one) and lossless (it round-trips exactly, where a
313
+ # UTF-8 decode cannot represent arbitrary bytes at all, and erases
314
+ # the distinction between the text "Hello" and the bytes b"Hello").
315
+ # It also removes a downstream hazard: rowversion/binary columns
316
+ # decoded as text carry embedded NULs that Postgres text and JSONB
317
+ # reject outright.
318
+ #
319
+ # Bare hex, with no `0x` prefix. A prefix would be more
320
+ # self-describing, but consumers already parse this shape -- the
321
+ # seeding path in stormbreaker recognises a hex rendering with
322
+ # `set(string) <= set("0123456789abcdef")` and calls
323
+ # `bytes.fromhex` -- and a prefix fails that test, so the value
324
+ # would fall through to `"0xdeadbeef".encode()` and seed those
325
+ # twelve literal characters instead of the four bytes. A rendering
326
+ # change here cannot be coordinated with consumers, so it stays in
327
+ # the vocabulary they already speak.
328
+ #
329
+ # Uniformity also *fixes* that heuristic rather than merely
330
+ # surviving it. Under the old per-value branch, the four bytes
331
+ # b"abcd" were valid UTF-8 and so arrived as the text "abcd", which
332
+ # the consumer then read as four hex digits and turned into the two
333
+ # bytes b"\xab\xcd". Rendering every value as hex makes b"abcd"
334
+ # arrive as "61626364", which round-trips to b"abcd".
335
+ return bytes(value).hex()
281
336
  if isinstance(value, Mapping):
282
337
  return {str(k): self.normalize_sample_value(v) for k, v in value.items()}
283
338
  if isinstance(value, (list, tuple, set, frozenset, range)):
@@ -27,6 +27,7 @@ from loguru import logger
27
27
  from dcs_core.core.common.errors import (
28
28
  DataChecksDataSourcesConnectionError,
29
29
  EstateSurfaceUnavailableError,
30
+ OdbcValueDecodeError,
30
31
  mssql_connection_error_message,
31
32
  )
32
33
  from dcs_core.core.common.models.data_source_resource import RawColumnInfo
@@ -308,60 +309,135 @@ class MssqlDataSource(SQLDataSource):
308
309
  return None
309
310
 
310
311
  def _register_output_converters(self) -> None:
311
- """Convert SQL Server extended ODBC types that pyodbc cannot fetch
312
- natively. Without these, a ``SELECT *`` over a table with a
313
- ``datetimeoffset`` / ``time`` / geometry-geography-hierarchyid (CLR UDT) /
314
- ``sql_variant`` column raises ``ODBC SQL type -15x is not yet supported``
315
- and the whole row fetch (sampling/profiling) fails. We decode the temporal
316
- types to ISO strings and the binary/variant types to hex so every column
317
- is fetchable and JSON-safe. Each converter is defensive — it never raises,
318
- so one odd value can't break a fetch."""
312
+ """Convert SQL Server extended ODBC types into faithful values.
313
+
314
+ Two different jobs are done here, and it is worth keeping them apart.
315
+
316
+ **Fetchability.** ``datetimeoffset`` (-155), CLR UDTs (-151:
317
+ geometry/geography/hierarchyid) and ``sql_variant`` (-150) cannot be
318
+ fetched by pyodbc at all -- a ``SELECT *`` over a table containing one
319
+ raises ``ODBC SQL type -15x is not yet supported`` and the entire row
320
+ fetch (sampling, profiling, seeding) dies. Verified still true on
321
+ pyodbc 5.3.0 + msodbcsql18 18.6.1.1, so these three are load-bearing.
322
+
323
+ **Fidelity.** ``time`` (-154) is *not* in that group: pyodbc decodes it
324
+ natively into a ``datetime.time``, so this converter is not needed to
325
+ make the column fetchable. It is kept anyway, because the native decode
326
+ is lossy. SQL Server's ``TIME`` defaults to ``TIME(7)`` -- 100-nanosecond
327
+ resolution -- and ``datetime.time`` only carries microseconds, so pyodbc
328
+ silently drops the seventh digit: ``00:00:00.0000001`` comes back as
329
+ ``00:00:00``, indistinguishable from midnight. In a tool whose whole
330
+ job is telling two datasets apart, a conversion that makes two different
331
+ source values identical is the most expensive kind of wrong. Decoding
332
+ the wire struct ourselves keeps every digit SQL Server stored.
333
+
334
+ The same reasoning applies to ``datetimeoffset(7)``, which is why both
335
+ temporal converters render their own ISO-8601 text rather than routing
336
+ through ``datetime``.
337
+
338
+ Nothing here is defensive. A converter that cannot decode its buffer
339
+ raises :class:`OdbcValueDecodeError` -- see that class for why silence
340
+ was worse than failure.
341
+ """
319
342
  conn = self.connection
320
343
  if conn is None or not hasattr(conn, "add_output_converter"):
321
344
  return
322
345
 
323
- def _safe(fn):
346
+ def _nullable(fn):
347
+ """NULL stays NULL; everything else is decoded or raises.
348
+
349
+ This replaces an earlier ``_safe`` wrapper that also caught every
350
+ exception and answered with ``raw.hex()``. That fallback is what
351
+ turned the ``_time2`` struct bug below into a silent data defect
352
+ rather than a loud crash, so it is gone.
353
+ """
354
+
324
355
  def _wrap(raw):
325
356
  if raw is None:
326
357
  return None
327
- try:
328
- return fn(raw)
329
- except Exception:
330
- try:
331
- return raw.hex() if isinstance(raw, (bytes, bytearray)) else str(raw)
332
- except Exception:
333
- return None
358
+ return fn(raw)
334
359
 
335
360
  return _wrap
336
361
 
362
+ def _iso_fraction(nanoseconds: int) -> str:
363
+ """Render a fractional second exactly, with no trailing noise.
364
+
365
+ SQL Server hands the fraction over in nanoseconds at 100ns
366
+ granularity. Rendering it as a trimmed 9-digit field reproduces the
367
+ stored value digit for digit -- ``.001``, ``.1234567``, ``.0000001``
368
+ -- where ``datetime`` would have to round or drop the last one.
369
+ """
370
+ if nanoseconds == 0:
371
+ return ""
372
+ return "." + f"{nanoseconds:09d}".rstrip("0")
373
+
374
+ def _check(raw, expected_len: int, sql_type: int, type_name: str) -> None:
375
+ if not isinstance(raw, (bytes, bytearray)):
376
+ raise OdbcValueDecodeError(sql_type, type_name, f"expected a buffer, got {type(raw).__name__}", raw)
377
+ if len(raw) != expected_len:
378
+ raise OdbcValueDecodeError(
379
+ sql_type, type_name, f"expected {expected_len} bytes, driver sent {len(raw)}", raw
380
+ )
381
+
337
382
  def _datetimeoffset(raw):
338
- # SQL_SS_TIMESTAMPOFFSET_STRUCT: year,month,day,hour,min,sec,
339
- # nanofraction (uint), tz_hour, tz_minute.
340
- t = struct.unpack("<6hI2h", raw)
341
- return datetime.datetime(
342
- t[0],
343
- t[1],
344
- t[2],
345
- t[3],
346
- t[4],
347
- t[5],
348
- t[6] // 1000,
349
- datetime.timezone(datetime.timedelta(hours=t[7], minutes=t[8])),
350
- ).isoformat()
383
+ # SQL_SS_TIMESTAMPOFFSET_STRUCT, from msodbcsql.h under `#pragma
384
+ # pack(8)`:
385
+ # SQLSMALLINT year <h offset 0
386
+ # SQLUSMALLINT month..second 5H offset 2..12
387
+ # SQLUINTEGER fraction (ns) I offset 12 (already 4-aligned,
388
+ # so no padding here)
389
+ # SQLSMALLINT timezone_hour h offset 16
390
+ # SQLSMALLINT timezone_minute h offset 18
391
+ # = 20 bytes. The timezone fields MUST stay signed: a UTC-08:00 value
392
+ # arrives as 0xfff8, which is -8 signed and 65528 unsigned.
393
+ _check(raw, 20, -155, "datetimeoffset")
394
+ year, month, day, hour, minute, second, fraction, tz_hour, tz_minute = struct.unpack("<h5HI2h", raw)
395
+ if not (1 <= month <= 12 and 1 <= day <= 31 and hour < 24 and minute < 60 and second < 60):
396
+ raise OdbcValueDecodeError(
397
+ -155,
398
+ "datetimeoffset",
399
+ f"implausible field values {year:04d}-{month:02d}-{day:02d} {hour:02d}:{minute:02d}:{second:02d}",
400
+ raw,
401
+ )
402
+ offset_minutes = tz_hour * 60 + tz_minute
403
+ sign = "-" if offset_minutes < 0 else "+"
404
+ offset_minutes = abs(offset_minutes)
405
+ return (
406
+ f"{year:04d}-{month:02d}-{day:02d}T{hour:02d}:{minute:02d}:{second:02d}"
407
+ f"{_iso_fraction(fraction)}{sign}{offset_minutes // 60:02d}:{offset_minutes % 60:02d}"
408
+ )
351
409
 
352
410
  def _time2(raw):
353
- # SQL_SS_TIME2_STRUCT: hour, minute, second, nanofraction (uint).
354
- t = struct.unpack("<3hI", raw)
355
- return datetime.time(t[0], t[1], t[2], t[3] // 1000).isoformat()
411
+ # SQL_SS_TIME2_STRUCT, from msodbcsql.h under `#pragma pack(8)`:
412
+ # SQLUSMALLINT hour, minute, second 3H offset 0..6
413
+ # (two bytes of padding) 2x offset 6..8
414
+ # SQLUINTEGER fraction (ns) I offset 8..12
415
+ # = 12 bytes, NOT 10. The 4-byte `fraction` must start on a 4-byte
416
+ # boundary, so the compiler inserts two bytes after `second`; a
417
+ # format string that omits them makes `struct.unpack` reject every
418
+ # single value the driver ever sends.
419
+ _check(raw, 12, -154, "time")
420
+ hour, minute, second, fraction = struct.unpack("<3H2xI", raw)
421
+ if not (hour < 24 and minute < 60 and second < 60):
422
+ raise OdbcValueDecodeError(
423
+ -154, "time", f"implausible field values {hour:02d}:{minute:02d}:{second:02d}", raw
424
+ )
425
+ return f"{hour:02d}:{minute:02d}:{second:02d}{_iso_fraction(fraction)}"
356
426
 
357
427
  def _as_hex(raw):
358
- return raw.hex() if isinstance(raw, (bytes, bytearray)) else str(raw)
428
+ # CLR UDTs and sql_variant have no faithful text form, so they are
429
+ # rendered as bare hex -- the same rendering
430
+ # `normalize_sample_value` gives every other `bytes` value, so one
431
+ # column cannot come back hex here and text there.
432
+ if isinstance(raw, (bytes, bytearray)):
433
+ return raw.hex()
434
+ return str(raw)
359
435
 
360
436
  try:
361
- conn.add_output_converter(-155, _safe(_datetimeoffset)) # datetimeoffset
362
- conn.add_output_converter(-154, _safe(_time2)) # time(n)
363
- conn.add_output_converter(-151, _safe(_as_hex)) # CLR UDT (geometry/geography/hierarchyid)
364
- conn.add_output_converter(-150, _safe(_as_hex)) # sql_variant
437
+ conn.add_output_converter(-155, _nullable(_datetimeoffset)) # datetimeoffset
438
+ conn.add_output_converter(-154, _nullable(_time2)) # time(n)
439
+ conn.add_output_converter(-151, _nullable(_as_hex)) # CLR UDT (geometry/geography/hierarchyid)
440
+ conn.add_output_converter(-150, _nullable(_as_hex)) # sql_variant
365
441
  except Exception as e: # pragma: no cover - defensive
366
442
  logger.warning(f"Could not register MSSQL output converters: {e}")
367
443
 
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "2.0.0"
15
+ __version__ = "2.1.0"
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dcs-sdk"
3
- version = "2.0.0"
3
+ version = "2.1.0"
4
4
  description = "SDK for DataChecks"
5
5
  authors = ["Waterdip Labs <hello@waterdip.ai>"]
6
6
  readme = "README.md"
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