dcs-sdk 2.2.3__tar.gz → 2.3.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.2.3 → dcs_sdk-2.3.0}/PKG-INFO +2 -2
  2. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/README.md +1 -1
  3. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/datasource/sql_datasource.py +172 -0
  4. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/bigquery.py +57 -0
  5. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/databricks.py +2 -0
  6. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/db2.py +2 -0
  7. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/mssql.py +52 -0
  8. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/mysql.py +4 -0
  9. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/oracle.py +2 -0
  10. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/postgres.py +65 -0
  11. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/redshift.py +45 -0
  12. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/sap_hana.py +2 -0
  13. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/snowflake.py +2 -0
  14. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/trino.py +48 -0
  15. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/vertica.py +50 -0
  16. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/__version__.py +1 -1
  17. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/pyproject.toml +1 -1
  18. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/__init__.py +0 -0
  19. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/__main__.py +0 -0
  20. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/abcs/__init__.py +0 -0
  21. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/abcs/compiler.py +0 -0
  22. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/abcs/database_types.py +0 -0
  23. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/config.py +0 -0
  24. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/__init__.py +0 -0
  25. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/_connect.py +0 -0
  26. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/base.py +0 -0
  27. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/bigquery.py +0 -0
  28. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/clickhouse.py +0 -0
  29. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/databricks.py +0 -0
  30. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/db2.py +0 -0
  31. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/duckdb.py +0 -0
  32. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/mssql.py +0 -0
  33. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/mysql.py +0 -0
  34. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/oracle.py +0 -0
  35. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/postgresql.py +0 -0
  36. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/presto.py +0 -0
  37. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/redis.py +0 -0
  38. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/redshift.py +0 -0
  39. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/sap_hana.py +0 -0
  40. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/snowflake.py +0 -0
  41. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/sybase.py +0 -0
  42. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/trino.py +0 -0
  43. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/databases/vertica.py +0 -0
  44. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/diff_tables.py +0 -0
  45. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/errors.py +0 -0
  46. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/format.py +0 -0
  47. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/hashdiff_tables.py +0 -0
  48. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/info_tree.py +0 -0
  49. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/joindiff_tables.py +0 -0
  50. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/lexicographic_space.py +0 -0
  51. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/parse_time.py +0 -0
  52. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/py.typed +0 -0
  53. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/queries/__init__.py +0 -0
  54. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/queries/api.py +0 -0
  55. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/queries/ast_classes.py +0 -0
  56. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/queries/base.py +0 -0
  57. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/queries/extras.py +0 -0
  58. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/query_utils.py +0 -0
  59. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/schema.py +0 -0
  60. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/streaming.py +0 -0
  61. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/table_segment.py +0 -0
  62. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/thread_utils.py +0 -0
  63. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/utils.py +0 -0
  64. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/data_diff/version.py +0 -0
  65. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/__init__.py +0 -0
  66. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/__main__.py +0 -0
  67. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/__version__.py +0 -0
  68. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/cli/__init__.py +0 -0
  69. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/cli/cli.py +0 -0
  70. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/__init__.py +0 -0
  71. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/__init__.py +0 -0
  72. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/errors.py +0 -0
  73. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/models/__init__.py +0 -0
  74. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/models/configuration.py +0 -0
  75. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/models/dashboard.py +0 -0
  76. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/models/data_source_resource.py +0 -0
  77. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/models/metric.py +0 -0
  78. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/models/profile.py +0 -0
  79. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/models/validation.py +0 -0
  80. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/common/models/widget.py +0 -0
  81. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/configuration/__init__.py +0 -0
  82. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/configuration/config_loader.py +0 -0
  83. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/configuration/configuration_parser.py +0 -0
  84. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/configuration/configuration_parser_arc.py +0 -0
  85. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/datasource/__init__.py +0 -0
  86. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/datasource/base.py +0 -0
  87. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/datasource/file_datasource.py +0 -0
  88. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/datasource/manager.py +0 -0
  89. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/datasource/search_datasource.py +0 -0
  90. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/inspect.py +0 -0
  91. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/logger/__init__.py +0 -0
  92. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/logger/base.py +0 -0
  93. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/logger/default_logger.py +0 -0
  94. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/metric/__init__.py +0 -0
  95. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/metric/base.py +0 -0
  96. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/metric/combined_metric.py +0 -0
  97. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/metric/custom_metric.py +0 -0
  98. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/metric/manager.py +0 -0
  99. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/metric/numeric_metric.py +0 -0
  100. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/metric/reliability_metric.py +0 -0
  101. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/observability/__init__.py +0 -0
  102. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/observability/connection_observer.py +0 -0
  103. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/profiling/__init__.py +0 -0
  104. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/profiling/datasource_profiling.py +0 -0
  105. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/profiling/numeric_field_profiling.py +0 -0
  106. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/profiling/text_field_profiling.py +0 -0
  107. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/repository/__init__.py +0 -0
  108. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/repository/metric_repository.py +0 -0
  109. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/utils/__init__.py +0 -0
  110. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/utils/log.py +0 -0
  111. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/utils/tracking.py +0 -0
  112. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/utils/utils.py +0 -0
  113. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/validation/__init__.py +0 -0
  114. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/validation/base.py +0 -0
  115. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/validation/completeness_validation.py +0 -0
  116. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/validation/custom_query_validation.py +0 -0
  117. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/validation/manager.py +0 -0
  118. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/validation/numeric_validation.py +0 -0
  119. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/validation/reliability_validation.py +0 -0
  120. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/validation/uniqueness_validation.py +0 -0
  121. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/core/validation/validity_validation.py +0 -0
  122. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/__init__.py +0 -0
  123. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/__init__.py +0 -0
  124. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/azure_blob.py +0 -0
  125. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/clickhouse.py +0 -0
  126. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/duck_db.py +0 -0
  127. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/elasticsearch.py +0 -0
  128. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/opensearch.py +0 -0
  129. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/presto.py +0 -0
  130. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/spark_df.py +0 -0
  131. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/databases/sybase.py +0 -0
  132. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/storage/__init__.py +0 -0
  133. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/storage/local_file.py +0 -0
  134. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/utils/__init__.py +0 -0
  135. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/integrations/utils/utils.py +0 -0
  136. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/__init__.py +0 -0
  137. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/dashboard.py +0 -0
  138. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/models.py +0 -0
  139. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/assets/fonts/DMSans-Bold.ttf +0 -0
  140. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/assets/fonts/DMSans-Medium.ttf +0 -0
  141. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/assets/fonts/DMSans-Regular.ttf +0 -0
  142. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/assets/fonts/DMSans-SemiBold.ttf +0 -0
  143. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/assets/images/docs.svg +0 -0
  144. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/assets/images/github.svg +0 -0
  145. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/assets/images/logo.svg +0 -0
  146. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/assets/images/slack.svg +0 -0
  147. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/index.js +0 -0
  148. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_core/report/static/index.js.LICENSE.txt +0 -0
  149. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/__init__.py +0 -0
  150. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/__main__.py +0 -0
  151. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/cli/__init__.py +0 -0
  152. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/cli/cli.py +0 -0
  153. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/__init__.py +0 -0
  154. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/config/__init__.py +0 -0
  155. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/config/config_loader.py +0 -0
  156. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/data_diff/__init__.py +0 -0
  157. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/data_diff/data_differ.py +0 -0
  158. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/rules/__init__.py +0 -0
  159. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/rules/rules_mappping.py +0 -0
  160. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/rules/rules_repository.py +0 -0
  161. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/rules/schema_rules.py +0 -0
  162. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/__init__.py +0 -0
  163. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/serializer.py +0 -0
  164. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/similarity_score/__init__.py +0 -0
  165. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/similarity_score/base_provider.py +0 -0
  166. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/similarity_score/cosine_similarity_provider.py +0 -0
  167. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/similarity_score/jaccard_provider.py +0 -0
  168. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/similarity_score/levenshtein_distance_provider.py +0 -0
  169. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/table.py +0 -0
  170. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/themes.py +0 -0
  171. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/sdk/utils/utils.py +0 -0
  172. {dcs_sdk-2.2.3 → dcs_sdk-2.3.0}/dcs_sdk/utils/__init__.py +0 -0
  173. {dcs_sdk-2.2.3 → dcs_sdk-2.3.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.2.3
3
+ Version: 2.3.0
4
4
  Summary: SDK for DataChecks
5
5
  Author: Waterdip Labs
6
6
  Author-email: hello@waterdip.ai
@@ -94,7 +94,7 @@ Requires-Dist: virtualenv (>=20.36.2,<21.0.0)
94
94
  Description-Content-Type: text/markdown
95
95
 
96
96
  <h1 align="center">
97
- DCS SDK v2.2.3
97
+ DCS SDK v2.3.0
98
98
  </h1>
99
99
 
100
100
  > SDK for DataChecks
@@ -1,5 +1,5 @@
1
1
  <h1 align="center">
2
- DCS SDK v2.2.3
2
+ DCS SDK v2.3.0
3
3
  </h1>
4
4
 
5
5
  > SDK for DataChecks
@@ -1670,6 +1670,178 @@ class SQLDataSource(DataSource):
1670
1670
  reason=str(e).splitlines()[0][:300],
1671
1671
  ) from e
1672
1672
 
1673
+ # ------------------------------------------------------------------
1674
+ # Catalog lookup by name
1675
+ #
1676
+ # A whole-schema read (``get_code_objects``) answers "what is in the
1677
+ # schemas I scan". A lineage scan also has to answer a narrower question
1678
+ # about schemas it did NOT scan: a procedure calls ``dev.func_b`` -- does
1679
+ # ``dev.func_b`` exist, what is it, and what does its body read? That is
1680
+ # this call. It is keyed by name because the question arrives as a
1681
+ # reference written in someone else's code.
1682
+ # ------------------------------------------------------------------
1683
+
1684
+ #: Object kinds that carry a body. One of these coming back without its
1685
+ #: body is a gap to report; a table without one is not.
1686
+ _BODY_KINDS = frozenset(
1687
+ {"view", "materialized_view", "procedure", "function", "table_function", "trigger", "package", "package_body"}
1688
+ )
1689
+
1690
+ #: How this engine stores an unquoted identifier: ``"upper"`` where
1691
+ #: ``dev`` is catalogued as ``DEV``, ``"lower"`` where ``DEV`` is
1692
+ #: catalogued as ``dev``. A reference is usually written unquoted, so the
1693
+ #: lookup retries a schema in this case when the schema as written has
1694
+ #: nothing in it.
1695
+ _UNQUOTED_IDENTIFIER_CASE: Optional[str] = None
1696
+
1697
+ @property
1698
+ def supports_catalog_lookup(self) -> bool:
1699
+ """Whether :meth:`find_catalog_objects` can answer on this connector.
1700
+ False means it would raise :class:`EstateSurfaceUnavailableError`,
1701
+ so a caller can skip the attempt and record the gap once."""
1702
+ return hasattr(self, "query_get_table_names")
1703
+
1704
+ @staticmethod
1705
+ def _catalog_literal(value: str) -> str:
1706
+ """A quoted SQL string literal for an identifier.
1707
+
1708
+ The connector API takes SQL text, not bind parameters, so the value is
1709
+ escaped here. A NUL, a colon (SQLAlchemy's ``text()`` reads ``:name``
1710
+ as a bind parameter) and a backslash (an escape character in MySQL's
1711
+ default mode) are refused rather than escaped: no real identifier needs
1712
+ them, and an escape that is right for one driver is wrong for another.
1713
+ """
1714
+ if any(char in value for char in ("\x00", ":", "\\")):
1715
+ raise ValueError(f"refusing to look up identifier {value!r}")
1716
+ return "'" + value.replace("'", "''") + "'"
1717
+
1718
+ def find_catalog_objects(self, names: List[Tuple[str, str]]) -> Dict[Tuple[str, str], List[Dict[str, Any]]]:
1719
+ """Look up objects by ``(schema, name)``, in any schema, with their body.
1720
+
1721
+ Every requested pair is a key of the result. An empty list means the
1722
+ catalog has no such object -- a factual answer, not a failure. Several
1723
+ rows under one key are several objects: an overload, or a table and a
1724
+ function that share a name.
1725
+
1726
+ Names are matched as the catalog stores them first and, failing that,
1727
+ case-insensitively, because a reference is usually written unquoted
1728
+ (``dev.func_b``) while Oracle and Snowflake store ``DEV.FUNC_B``.
1729
+
1730
+ Each row has ``schema_name``, ``name``, ``object_kind``,
1731
+ ``definition``, ``definition_available`` and ``unreadable_reason``:
1732
+ ``None`` when the body was read or the kind has none, ``"permission"``
1733
+ when the login may not read it, ``"not_exposed"`` when the catalog does
1734
+ not return it (encrypted, compiled, secure, or not read by this
1735
+ connector). ``meta`` carries what the connector's
1736
+ :meth:`get_code_objects` carries (overload signatures).
1737
+
1738
+ This default reads each requested schema once through
1739
+ :meth:`query_get_table_names` and, where the connector has it,
1740
+ :meth:`get_code_objects`, so the cost is per schema, not per name.
1741
+ Connectors with a cheaper single-object read override it.
1742
+
1743
+ :raises EstateSurfaceUnavailableError: the connector cannot list a
1744
+ schema's objects at all, or a read failed.
1745
+ :raises ValueError: an identifier contains a character that cannot be
1746
+ put in SQL text safely.
1747
+ """
1748
+ if not self.supports_catalog_lookup:
1749
+ raise self._estate_surface_unsupported("catalog_lookup")
1750
+ result: Dict[Tuple[str, str], List[Dict[str, Any]]] = {(schema, name): [] for schema, name in names}
1751
+ by_schema: Dict[str, List[str]] = {}
1752
+ for schema, name in result:
1753
+ by_schema.setdefault(schema, []).append(name)
1754
+ for schema, wanted in by_schema.items():
1755
+ for name in wanted:
1756
+ self._catalog_literal(name)
1757
+ # Spellings are merged, not tried until one returns something: a
1758
+ # connector's code read may fold the schema itself (Oracle's does)
1759
+ # while its table listing does not, so the first spelling can
1760
+ # return code and no tables. A non-empty listing is the exact
1761
+ # schema, and ends the search.
1762
+ objects: List[Dict[str, Any]] = []
1763
+ seen: set = set()
1764
+ for spelling in self._schema_spellings(schema):
1765
+ found, listed_any = self._schema_catalog_objects(spelling)
1766
+ for obj in found:
1767
+ key = (obj["schema_name"], obj["name"], obj["object_kind"], str(obj.get("meta")))
1768
+ if key not in seen:
1769
+ seen.add(key)
1770
+ objects.append(obj)
1771
+ if listed_any:
1772
+ break
1773
+ for name in wanted:
1774
+ result[(schema, name)] = self._match_catalog_name(objects, name)
1775
+ return result
1776
+
1777
+ def _schema_spellings(self, schema: str) -> List[str]:
1778
+ """The schema as written, then as the engine folds an unquoted one.
1779
+ The connectors' own listings put the schema into SQL unescaped, so a
1780
+ quote in it is refused here as well as the characters
1781
+ :meth:`_catalog_literal` refuses."""
1782
+ self._catalog_literal(schema)
1783
+ if "'" in schema:
1784
+ raise ValueError(f"refusing to look up schema {schema!r}")
1785
+ folded = {"upper": schema.upper(), "lower": schema.lower()}.get(self._UNQUOTED_IDENTIFIER_CASE or "")
1786
+ return [schema] + ([folded] if folded and folded != schema else [])
1787
+
1788
+ def _schema_catalog_objects(self, schema: str) -> Tuple[List[Dict[str, Any]], bool]:
1789
+ """One schema's objects in the lookup's row shape: tables and views
1790
+ from the table listing, bodies from ``get_code_objects`` where the
1791
+ connector has it. The flag says whether the listing had anything."""
1792
+ try:
1793
+ listing = self.query_get_table_names(schema=schema, with_view=True) or {}
1794
+ except Exception as e: # noqa: BLE001 - re-raised as a typed surface error
1795
+ raise EstateSurfaceUnavailableError(
1796
+ f"Could not list schema '{schema}' on {self.data_source_name}",
1797
+ surface="catalog_lookup",
1798
+ reason=str(e).splitlines()[0][:300] if str(e) else type(e).__name__,
1799
+ ) from e
1800
+ listed: Dict[Tuple[str, str], Dict[str, Any]] = {}
1801
+ for kind in ("table", "view"):
1802
+ for table_name in listing.get(kind) or []:
1803
+ listed[(str(table_name), kind)] = self._catalog_row(schema, str(table_name), kind, None)
1804
+ listed_any = bool(listed)
1805
+ code: List[Dict[str, Any]] = []
1806
+ code_objects = getattr(self, "get_code_objects", None)
1807
+ for obj in (code_objects(schema) or []) if code_objects is not None else []:
1808
+ name, kind = obj.get("name"), obj.get("object_kind")
1809
+ if not name or not kind:
1810
+ continue
1811
+ row = self._catalog_row(obj.get("schema_name") or schema, str(name), kind, obj.get("definition"))
1812
+ meta = dict(obj.get("meta") or {})
1813
+ for key in ("argument_signature", "identity_arguments"):
1814
+ if obj.get(key) is not None:
1815
+ meta[key] = obj[key]
1816
+ if meta:
1817
+ row["meta"] = meta
1818
+ # The code read is the better record of a view: it has the body.
1819
+ # A table listing may also report a materialized view as a view.
1820
+ listed.pop((str(name), kind), None)
1821
+ if kind == "materialized_view":
1822
+ listed.pop((str(name), "view"), None)
1823
+ code.append(row)
1824
+ return list(listed.values()) + code, listed_any
1825
+
1826
+ def _catalog_row(self, schema: str, name: str, kind: str, definition: Optional[str]) -> Dict[str, Any]:
1827
+ has_body = kind in self._BODY_KINDS
1828
+ return {
1829
+ "schema_name": schema,
1830
+ "name": name,
1831
+ "object_kind": kind,
1832
+ "definition": definition,
1833
+ "definition_available": definition is not None,
1834
+ "unreadable_reason": "not_exposed" if has_body and definition is None else None,
1835
+ }
1836
+
1837
+ @staticmethod
1838
+ def _match_catalog_name(objects: List[Dict[str, Any]], name: str) -> List[Dict[str, Any]]:
1839
+ exact = [obj for obj in objects if obj["name"] == name]
1840
+ if exact:
1841
+ return exact
1842
+ folded = name.casefold()
1843
+ return [obj for obj in objects if obj["name"].casefold() == folded]
1844
+
1673
1845
  def get_security_principals(self, schema: str | None = None) -> Dict[str, List[Dict]]:
1674
1846
  """Roles, users/logins, role memberships and object-level grants.
1675
1847
 
@@ -388,6 +388,63 @@ class BigQueryDataSource(SQLDataSource):
388
388
  rows = self.fetchall(query)
389
389
  return {row[0]: row[1] for row in rows if row[1]} if rows else {}
390
390
 
391
+ #: INFORMATION_SCHEMA.ROUTINES routine_type, as the SDK's object kinds.
392
+ _ROUTINE_KINDS = {"PROCEDURE": "procedure", "FUNCTION": "function", "TABLE FUNCTION": "table_function"}
393
+
394
+ def get_code_objects(self, schema: str | None = None) -> List[Dict[str, Any]]:
395
+ """Views, materialized views and routines of one dataset, each with
396
+ its full ``ddl``. A dataset is BigQuery's schema; INFORMATION_SCHEMA is
397
+ per dataset, so ``schema`` omitted reads the connection's own.
398
+
399
+ A JavaScript or remote function's body is not SQL; its ``language``
400
+ says so, and a caller parsing SQL skips it.
401
+ """
402
+ dataset = self._resolve_dataset(schema)
403
+ if "`" in dataset or "\\" in dataset:
404
+ raise ValueError(f"refusing to read dataset {dataset!r}")
405
+ prefix = f"`{self.project_id}.{dataset}.INFORMATION_SCHEMA"
406
+ objects: List[Dict[str, Any]] = []
407
+ for row in self._estate_surface(
408
+ "code_objects",
409
+ f"""
410
+ SELECT table_schema AS schema_name, table_name AS name, table_type, ddl AS definition
411
+ FROM {prefix}.TABLES`
412
+ WHERE table_type IN ('VIEW', 'MATERIALIZED VIEW')
413
+ ORDER BY table_name
414
+ """,
415
+ ):
416
+ kind = "materialized_view" if row.get("table_type") == "MATERIALIZED VIEW" else "view"
417
+ objects.append(
418
+ {
419
+ "schema_name": row.get("schema_name"),
420
+ "name": row.get("name"),
421
+ "object_kind": kind,
422
+ "language": "sql",
423
+ "definition": row.get("definition"),
424
+ }
425
+ )
426
+ for row in self._estate_surface(
427
+ "code_objects",
428
+ f"""
429
+ SELECT routine_schema AS schema_name, routine_name AS name, routine_type,
430
+ routine_body, external_language, ddl AS definition
431
+ FROM {prefix}.ROUTINES`
432
+ ORDER BY routine_name
433
+ """,
434
+ ):
435
+ objects.append(
436
+ {
437
+ "schema_name": row.get("schema_name"),
438
+ "name": row.get("name"),
439
+ "object_kind": self._ROUTINE_KINDS.get(row.get("routine_type") or "", "function"),
440
+ "language": (row.get("external_language") or row.get("routine_body") or "SQL").lower(),
441
+ "definition": row.get("definition"),
442
+ }
443
+ )
444
+ for obj in objects:
445
+ obj["definition_available"] = obj.get("definition") is not None
446
+ return objects
447
+
391
448
  def query_trigger_definitions(self, schema: str) -> Dict[str, str]:
392
449
  return {}
393
450
 
@@ -32,6 +32,8 @@ from dcs_core.core.datasource.sql_datasource import SQLDataSource
32
32
 
33
33
 
34
34
  class DatabricksDataSource(SQLDataSource):
35
+ _UNQUOTED_IDENTIFIER_CASE = "lower"
36
+
35
37
  SQLGLOT_DIALECT = "databricks"
36
38
 
37
39
  def __init__(self, data_source_name: str, data_connection: Dict):
@@ -31,6 +31,8 @@ ibm_db2_dll_files_loader()
31
31
 
32
32
 
33
33
  class DB2DataSource(SQLDataSource):
34
+ _UNQUOTED_IDENTIFIER_CASE = "upper"
35
+
34
36
  SQLGLOT_DIALECT = None
35
37
 
36
38
  def __init__(self, data_source_name: str, data_connection: Dict):
@@ -2562,6 +2562,58 @@ class MssqlDataSource(SQLDataSource):
2562
2562
  row["definition_available"] = row.get("definition") is not None
2563
2563
  return rows
2564
2564
 
2565
+ #: sys.objects types the catalog lookup reports, beyond the code kinds.
2566
+ _LOOKUP_TYPE_KINDS = {**_OBJECT_TYPE_KINDS, "U": "table", "SN": "synonym", "SO": "sequence"}
2567
+
2568
+ def find_catalog_objects(self, names: List[Tuple[str, str]]) -> Dict[Tuple[str, str], List[Dict[str, Any]]]:
2569
+ """One ``sys.objects`` read per name, so a reference into a schema
2570
+ that was never scanned costs one round-trip, not a schema read.
2571
+
2572
+ ``OBJECT_DEFINITION`` returns NULL both when the login lacks VIEW
2573
+ DEFINITION and when the module is encrypted or CLR-backed. The
2574
+ permission check asked alongside it tells the two apart, and they are
2575
+ reported differently: one is fixed by a grant, the other by nothing.
2576
+ A synonym carries the object it points at in ``meta``.
2577
+
2578
+ SQL Server hides an object from ``sys.objects`` entirely when the
2579
+ login holds no permission on it, so for such a login an existing
2580
+ object and an absent one both come back as an empty list.
2581
+ """
2582
+ result: Dict[Tuple[str, str], List[Dict[str, Any]]] = {}
2583
+ types = ", ".join(f"'{code}'" for code in sorted(self._LOOKUP_TYPE_KINDS))
2584
+ for schema, name in names:
2585
+ rows = self._estate_surface(
2586
+ "catalog_lookup",
2587
+ f"""
2588
+ SELECT s.name AS schema_name,
2589
+ o.name AS name,
2590
+ o.type AS sys_type,
2591
+ OBJECT_DEFINITION(o.object_id) AS definition,
2592
+ HAS_PERMS_BY_NAME(QUOTENAME(s.name) + '.' + QUOTENAME(o.name),
2593
+ 'OBJECT', 'VIEW DEFINITION') AS can_view_definition,
2594
+ sn.base_object_name
2595
+ FROM sys.objects o
2596
+ JOIN sys.schemas s ON s.schema_id = o.schema_id
2597
+ LEFT JOIN sys.synonyms sn ON sn.object_id = o.object_id
2598
+ WHERE s.name = N{self._catalog_literal(schema)}
2599
+ AND o.name = N{self._catalog_literal(name)}
2600
+ AND o.type IN ({types})
2601
+ AND o.is_ms_shipped = 0
2602
+ ORDER BY o.name, o.type
2603
+ """,
2604
+ )
2605
+ found = []
2606
+ for row in rows:
2607
+ kind = self._LOOKUP_TYPE_KINDS[(row.get("sys_type") or "").strip()]
2608
+ entry = self._catalog_row(row["schema_name"], row["name"], kind, row.get("definition"))
2609
+ if entry["unreadable_reason"] is not None and row.get("can_view_definition") == 0:
2610
+ entry["unreadable_reason"] = "permission"
2611
+ if row.get("base_object_name"):
2612
+ entry["meta"] = {"base_object_name": row["base_object_name"]}
2613
+ found.append(entry)
2614
+ result[(schema, name)] = found
2615
+ return result
2616
+
2565
2617
  def get_tier3_assets(self, schema: str | None = None) -> Dict[str, Any]:
2566
2618
  """The surrounding surface a translation must be aware of but cannot
2567
2619
  translate: CLR assemblies, SQL Agent jobs, SSIS packages.
@@ -32,6 +32,10 @@ from dcs_core.integrations.databases.db2 import DB2DataSource
32
32
 
33
33
 
34
34
  class MysqlDataSource(DB2DataSource):
35
+ # Inherited from DB2, which folds unquoted names to upper case; MySQL keeps
36
+ # them as written.
37
+ _UNQUOTED_IDENTIFIER_CASE = None
38
+
35
39
  SQLGLOT_DIALECT = "mysql"
36
40
 
37
41
  def __init__(self, data_source_name: str, data_connection: Dict):
@@ -31,6 +31,8 @@ from dcs_sdk.utils.temp_objects import (
31
31
 
32
32
 
33
33
  class OracleDataSource(SQLDataSource):
34
+ _UNQUOTED_IDENTIFIER_CASE = "upper"
35
+
34
36
  SQLGLOT_DIALECT = "oracle"
35
37
 
36
38
  def __init__(self, data_source_name: str, data_connection: Dict):
@@ -1523,6 +1523,71 @@ class PostgresDataSource(SQLDataSource):
1523
1523
  },
1524
1524
  }
1525
1525
 
1526
+ _LOOKUP_RELKIND = {"r": "table", "p": "table", "v": "view", "m": "materialized_view", "f": "foreign_table"}
1527
+
1528
+ def find_catalog_objects(self, names: List[Tuple[str, str]]) -> Dict[Tuple[str, str], List[Dict[str, Any]]]:
1529
+ """One catalog read per name: relations from ``pg_class``, routines
1530
+ from ``pg_proc``. A name can be both a table and a function in the
1531
+ same schema, and a function can be overloaded, so every match is
1532
+ returned; ``meta.identity_arguments`` tells overloads apart.
1533
+
1534
+ A view's definition is its SELECT body (``pg_get_viewdef``), a
1535
+ routine's is its full CREATE (``pg_get_functiondef``), matching
1536
+ :meth:`get_code_objects`. A C or internal function has no SQL body and
1537
+ is reported ``not_exposed``. A name is matched as written and as
1538
+ Postgres folds an unquoted one (lower case).
1539
+ """
1540
+ result: Dict[Tuple[str, str], List[Dict[str, Any]]] = {}
1541
+ for schema, name in names:
1542
+ schema_literal = self._catalog_literal(schema)
1543
+ name_literal = self._catalog_literal(name)
1544
+ rows = self._estate_surface(
1545
+ "catalog_lookup",
1546
+ f"""
1547
+ SELECT n.nspname AS schema_name,
1548
+ c.relname AS name,
1549
+ c.relkind::text AS kind,
1550
+ CASE WHEN c.relkind IN ('v', 'm') THEN pg_get_viewdef(c.oid) END AS definition,
1551
+ NULL::text AS identity_arguments
1552
+ FROM pg_class c
1553
+ JOIN pg_namespace n ON n.oid = c.relnamespace
1554
+ WHERE n.nspname IN ({schema_literal}, lower({schema_literal}))
1555
+ AND c.relname IN ({name_literal}, lower({name_literal}))
1556
+ AND c.relkind IN ('r', 'p', 'v', 'm', 'f')
1557
+ UNION ALL
1558
+ SELECT n.nspname,
1559
+ p.proname,
1560
+ CASE
1561
+ WHEN p.prokind = 'p' THEN 'procedure'
1562
+ WHEN p.prokind = 'a' THEN 'aggregate'
1563
+ WHEN p.proretset THEN 'table_function'
1564
+ ELSE 'function'
1565
+ END,
1566
+ -- An aggregate has no body (pg_get_functiondef refuses
1567
+ -- one); its state and final functions are its code.
1568
+ CASE
1569
+ WHEN p.prokind <> 'a' AND l.lanname NOT IN ('c', 'internal')
1570
+ THEN pg_get_functiondef(p.oid)
1571
+ END,
1572
+ pg_get_function_identity_arguments(p.oid)
1573
+ FROM pg_proc p
1574
+ JOIN pg_namespace n ON n.oid = p.pronamespace
1575
+ JOIN pg_language l ON l.oid = p.prolang
1576
+ WHERE n.nspname IN ({schema_literal}, lower({schema_literal}))
1577
+ AND p.proname IN ({name_literal}, lower({name_literal}))
1578
+ AND p.prokind IN ('f', 'p', 'a')
1579
+ """,
1580
+ )
1581
+ found = []
1582
+ for row in rows:
1583
+ kind = self._LOOKUP_RELKIND.get(row["kind"], row["kind"])
1584
+ entry = self._catalog_row(row["schema_name"], row["name"], kind, row.get("definition"))
1585
+ if row.get("identity_arguments") is not None:
1586
+ entry["meta"] = {"identity_arguments": row["identity_arguments"]}
1587
+ found.append(entry)
1588
+ result[(schema, name)] = found
1589
+ return result
1590
+
1526
1591
  def get_code_objects(self, schema: str | None = None) -> List[Dict[str, Any]]:
1527
1592
  """Every object that carries a body: functions, procedures, views,
1528
1593
  materialized views and triggers, with their source.
@@ -22,6 +22,8 @@ from dcs_core.core.datasource.sql_datasource import SQLDataSource
22
22
 
23
23
 
24
24
  class RedShiftDataSource(SQLDataSource):
25
+ _UNQUOTED_IDENTIFIER_CASE = "lower"
26
+
25
27
  SQLGLOT_DIALECT = "redshift"
26
28
 
27
29
  def __init__(self, data_source_name: str, data_connection: Dict):
@@ -110,6 +112,49 @@ class RedShiftDataSource(SQLDataSource):
110
112
  else {}
111
113
  )
112
114
 
115
+ def get_code_objects(self, schema: str | None = None) -> List[Dict[str, Any]]:
116
+ """Views, SQL/Python UDFs and stored procedures with their text.
117
+
118
+ Redshift keeps PostgreSQL 8's catalog, so ``pg_proc`` has no
119
+ ``prokind``: ``pg_proc_info`` (Redshift's own view over it) says which
120
+ rows are procedures. The body is ``prosrc``, the text between the
121
+ ``$$`` quotes rather than a full CREATE, and a view's is its SELECT
122
+ (``pg_views``), matching what the Postgres connector returns for a
123
+ view.
124
+ """
125
+ schema = schema or self.schema_name
126
+ ns_filter = f"AND n.nspname = {self._catalog_literal(schema)}" if schema else ""
127
+ view_filter = f"AND schemaname = {self._catalog_literal(schema)}" if schema else ""
128
+ objects: List[Dict[str, Any]] = []
129
+ for row in self._estate_surface(
130
+ "code_objects",
131
+ f"""
132
+ SELECT schemaname AS schema_name, viewname AS name, definition
133
+ FROM pg_views
134
+ WHERE schemaname NOT IN ('pg_catalog', 'information_schema') {view_filter}
135
+ ORDER BY schemaname, viewname
136
+ """,
137
+ ):
138
+ objects.append({**row, "object_kind": "view", "language": "sql"})
139
+ for row in self._estate_surface(
140
+ "code_objects",
141
+ f"""
142
+ SELECT n.nspname AS schema_name, p.proname AS name,
143
+ CASE WHEN p.prokind = 'p' THEN 'procedure' ELSE 'function' END AS object_kind,
144
+ l.lanname AS language, p.prosrc AS definition
145
+ FROM pg_proc_info p
146
+ JOIN pg_namespace n ON n.oid = p.pronamespace
147
+ JOIN pg_language l ON l.oid = p.prolang
148
+ WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')
149
+ AND l.lanname NOT IN ('internal', 'c') {ns_filter}
150
+ ORDER BY n.nspname, p.proname
151
+ """,
152
+ ):
153
+ objects.append(row)
154
+ for obj in objects:
155
+ obj["definition_available"] = obj.get("definition") is not None
156
+ return objects
157
+
113
158
  def get_view_dependency_map(self, schema: str) -> Dict[str, List[str]]:
114
159
  schema = schema or self.schema_name
115
160
  query = f"""
@@ -116,6 +116,8 @@ class _NoOpEngine:
116
116
 
117
117
 
118
118
  class SapHanaDataSource(SQLDataSource):
119
+ _UNQUOTED_IDENTIFIER_CASE = "upper"
120
+
119
121
  # sqlglot does not support a dedicated "hana" dialect name.
120
122
  # Use the generic parser for dependency extraction after HANA-specific normalization.
121
123
  SQLGLOT_DIALECT = None
@@ -58,6 +58,8 @@ def get_snowflake_port(port: int | str | None = None) -> int:
58
58
 
59
59
 
60
60
  class SnowFlakeDataSource(SQLDataSource):
61
+ _UNQUOTED_IDENTIFIER_CASE = "upper"
62
+
61
63
  SQLGLOT_DIALECT = "snowflake"
62
64
 
63
65
  def __init__(self, data_source_name: str, data_connection: Dict):
@@ -36,6 +36,8 @@ _TIME_RE = re.compile(r"^timestamp\((\d+)\)(?:\s+with time zone)?$|^time\((\d+)\
36
36
 
37
37
 
38
38
  class TrinoDataSource(SQLDataSource):
39
+ _UNQUOTED_IDENTIFIER_CASE = "lower"
40
+
39
41
  """
40
42
  Trino connects via its own bundled SQLAlchemy dialect (trino.sqlalchemy),
41
43
  unlike Presto (see presto.py) which has no SQLAlchemy dialect at all and needs
@@ -222,6 +224,52 @@ class TrinoDataSource(SQLDataSource):
222
224
 
223
225
  return result
224
226
 
227
+ def get_code_objects(self, schema: str | None = None) -> List[Dict[str, Any]]:
228
+ """Views and materialized views with their SQL. Trino connectors keep
229
+ no stored procedures or SQL functions of their own in the catalog
230
+ this reads, so a view is the only code a lineage walk can follow here.
231
+
232
+ ``view_definition`` is the view's SELECT; ``system.metadata`` holds the
233
+ materialized views, and a catalog that has none (or a connector that
234
+ cannot have them) is an empty answer, not a failure.
235
+ """
236
+ schema = schema or self.schema_name
237
+ schema_filter = f"AND table_schema = {self._catalog_literal(schema)}" if schema else ""
238
+ rows = self._estate_surface(
239
+ "code_objects",
240
+ f"""
241
+ SELECT table_schema AS schema_name, table_name AS name, view_definition AS definition
242
+ FROM {self._info_schema_prefix()}.views
243
+ WHERE table_schema <> 'information_schema' {schema_filter}
244
+ ORDER BY table_schema, table_name
245
+ """,
246
+ )
247
+ objects = [
248
+ {**row, "object_kind": "view", "language": "sql", "definition_available": row.get("definition") is not None}
249
+ for row in rows
250
+ ]
251
+ catalog = getattr(self, "catalog_name", None)
252
+ if catalog:
253
+ mv_filter = f"AND schema_name = {self._catalog_literal(schema)}" if schema else ""
254
+ for row in self._estate_surface(
255
+ "code_objects",
256
+ f"""
257
+ SELECT schema_name, name, definition
258
+ FROM system.metadata.materialized_views
259
+ WHERE catalog_name = {self._catalog_literal(catalog)} {mv_filter}
260
+ """,
261
+ optional=True,
262
+ ):
263
+ objects.append(
264
+ {
265
+ **row,
266
+ "object_kind": "materialized_view",
267
+ "language": "sql",
268
+ "definition_available": row.get("definition") is not None,
269
+ }
270
+ )
271
+ return objects
272
+
225
273
  @staticmethod
226
274
  def _parse_data_type(data_type: str) -> Dict[str, Any]:
227
275
  """Extract precision/scale/length embedded in Trino's compact type strings
@@ -229,6 +229,56 @@ class VerticaDataSource(SQLDataSource):
229
229
  result = {"table": [row[0] for row in rows]} if rows else {"table": []}
230
230
  return result
231
231
 
232
+ def get_code_objects(self, schema: str | None = None) -> List[Dict[str, Any]]:
233
+ """Views and SQL functions with their text.
234
+
235
+ ``v_catalog.user_functions`` lists every user function; only a SQL
236
+ function (a macro, ``RETURN <expr>``) has its body there. A UDx or a
237
+ library function is compiled code, reported with no definition so a
238
+ caller records it as not exposed rather than as missing.
239
+ """
240
+ schema = schema or self.schema_name
241
+ view_filter = f"AND table_schema = {self._catalog_literal(schema)}" if schema else ""
242
+ fn_filter = f"AND schema_name = {self._catalog_literal(schema)}" if schema else ""
243
+ objects: List[Dict[str, Any]] = []
244
+ for row in self._estate_surface(
245
+ "code_objects",
246
+ f"""
247
+ SELECT table_schema AS schema_name, table_name AS name, view_definition AS definition
248
+ FROM v_catalog.views
249
+ WHERE is_system_view = false {view_filter}
250
+ ORDER BY table_schema, table_name
251
+ """,
252
+ ):
253
+ objects.append({**row, "object_kind": "view", "language": "sql"})
254
+ for row in self._estate_surface(
255
+ "code_objects",
256
+ f"""
257
+ SELECT schema_name, function_name AS name,
258
+ function_argument_type, function_definition AS definition
259
+ FROM v_catalog.user_functions
260
+ WHERE true {fn_filter}
261
+ ORDER BY schema_name, function_name
262
+ """,
263
+ ):
264
+ # A SQL function's definition is its body ("RETURN ..."); a UDx's
265
+ # names its class and library ("Class 'X' in Library 'Y'"), and
266
+ # procedure_type reads "User Defined Function" for both.
267
+ is_sql = str(row.get("definition") or "").lstrip().upper().startswith("RETURN")
268
+ objects.append(
269
+ {
270
+ "schema_name": row.get("schema_name"),
271
+ "name": row.get("name"),
272
+ "object_kind": "function",
273
+ "language": "sql" if is_sql else "udx",
274
+ "definition": row.get("definition") if is_sql else None,
275
+ "meta": {"argument_types": row.get("function_argument_type")},
276
+ }
277
+ )
278
+ for obj in objects:
279
+ obj["definition_available"] = obj.get("definition") is not None
280
+ return objects
281
+
232
282
  def query_get_table_columns(
233
283
  self,
234
284
  table: str,
@@ -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.2.3"
15
+ __version__ = "2.3.0"
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "dcs-sdk"
3
- version = "2.2.3"
3
+ version = "2.3.0"
4
4
  description = "SDK for DataChecks"
5
5
  authors = ["Waterdip Labs <hello@waterdip.ai>"]
6
6
  readme = "README.md"
File without changes