dcs-sdk 2.2.3__tar.gz → 2.3.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 (173) hide show
  1. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/PKG-INFO +2 -2
  2. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/README.md +1 -1
  3. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/datasource/sql_datasource.py +176 -1
  4. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/bigquery.py +57 -0
  5. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/databricks.py +2 -0
  6. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/db2.py +2 -0
  7. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/mssql.py +61 -7
  8. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/mysql.py +4 -0
  9. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/oracle.py +2 -0
  10. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/postgres.py +65 -0
  11. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/redshift.py +45 -0
  12. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/sap_hana.py +2 -0
  13. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/snowflake.py +2 -0
  14. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/trino.py +48 -0
  15. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/vertica.py +50 -0
  16. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/__version__.py +1 -1
  17. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/pyproject.toml +1 -1
  18. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/__init__.py +0 -0
  19. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/__main__.py +0 -0
  20. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/abcs/__init__.py +0 -0
  21. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/abcs/compiler.py +0 -0
  22. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/abcs/database_types.py +0 -0
  23. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/config.py +0 -0
  24. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/__init__.py +0 -0
  25. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/_connect.py +0 -0
  26. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/base.py +0 -0
  27. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/bigquery.py +0 -0
  28. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/clickhouse.py +0 -0
  29. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/databricks.py +0 -0
  30. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/db2.py +0 -0
  31. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/duckdb.py +0 -0
  32. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/mssql.py +0 -0
  33. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/mysql.py +0 -0
  34. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/oracle.py +0 -0
  35. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/postgresql.py +0 -0
  36. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/presto.py +0 -0
  37. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/redis.py +0 -0
  38. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/redshift.py +0 -0
  39. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/sap_hana.py +0 -0
  40. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/snowflake.py +0 -0
  41. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/sybase.py +0 -0
  42. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/trino.py +0 -0
  43. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/databases/vertica.py +0 -0
  44. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/diff_tables.py +0 -0
  45. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/errors.py +0 -0
  46. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/format.py +0 -0
  47. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/hashdiff_tables.py +0 -0
  48. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/info_tree.py +0 -0
  49. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/joindiff_tables.py +0 -0
  50. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/lexicographic_space.py +0 -0
  51. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/parse_time.py +0 -0
  52. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/py.typed +0 -0
  53. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/queries/__init__.py +0 -0
  54. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/queries/api.py +0 -0
  55. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/queries/ast_classes.py +0 -0
  56. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/queries/base.py +0 -0
  57. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/queries/extras.py +0 -0
  58. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/query_utils.py +0 -0
  59. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/schema.py +0 -0
  60. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/streaming.py +0 -0
  61. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/table_segment.py +0 -0
  62. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/thread_utils.py +0 -0
  63. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/utils.py +0 -0
  64. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/data_diff/version.py +0 -0
  65. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/__init__.py +0 -0
  66. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/__main__.py +0 -0
  67. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/__version__.py +0 -0
  68. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/cli/__init__.py +0 -0
  69. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/cli/cli.py +0 -0
  70. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/__init__.py +0 -0
  71. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/__init__.py +0 -0
  72. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/errors.py +0 -0
  73. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/models/__init__.py +0 -0
  74. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/models/configuration.py +0 -0
  75. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/models/dashboard.py +0 -0
  76. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/models/data_source_resource.py +0 -0
  77. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/models/metric.py +0 -0
  78. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/models/profile.py +0 -0
  79. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/models/validation.py +0 -0
  80. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/common/models/widget.py +0 -0
  81. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/configuration/__init__.py +0 -0
  82. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/configuration/config_loader.py +0 -0
  83. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/configuration/configuration_parser.py +0 -0
  84. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/configuration/configuration_parser_arc.py +0 -0
  85. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/datasource/__init__.py +0 -0
  86. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/datasource/base.py +0 -0
  87. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/datasource/file_datasource.py +0 -0
  88. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/datasource/manager.py +0 -0
  89. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/datasource/search_datasource.py +0 -0
  90. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/inspect.py +0 -0
  91. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/logger/__init__.py +0 -0
  92. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/logger/base.py +0 -0
  93. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/logger/default_logger.py +0 -0
  94. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/metric/__init__.py +0 -0
  95. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/metric/base.py +0 -0
  96. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/metric/combined_metric.py +0 -0
  97. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/metric/custom_metric.py +0 -0
  98. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/metric/manager.py +0 -0
  99. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/metric/numeric_metric.py +0 -0
  100. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/metric/reliability_metric.py +0 -0
  101. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/observability/__init__.py +0 -0
  102. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/observability/connection_observer.py +0 -0
  103. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/profiling/__init__.py +0 -0
  104. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/profiling/datasource_profiling.py +0 -0
  105. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/profiling/numeric_field_profiling.py +0 -0
  106. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/profiling/text_field_profiling.py +0 -0
  107. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/repository/__init__.py +0 -0
  108. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/repository/metric_repository.py +0 -0
  109. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/utils/__init__.py +0 -0
  110. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/utils/log.py +0 -0
  111. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/utils/tracking.py +0 -0
  112. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/utils/utils.py +0 -0
  113. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/validation/__init__.py +0 -0
  114. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/validation/base.py +0 -0
  115. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/validation/completeness_validation.py +0 -0
  116. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/validation/custom_query_validation.py +0 -0
  117. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/validation/manager.py +0 -0
  118. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/validation/numeric_validation.py +0 -0
  119. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/validation/reliability_validation.py +0 -0
  120. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/validation/uniqueness_validation.py +0 -0
  121. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/core/validation/validity_validation.py +0 -0
  122. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/__init__.py +0 -0
  123. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/__init__.py +0 -0
  124. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/azure_blob.py +0 -0
  125. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/clickhouse.py +0 -0
  126. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/duck_db.py +0 -0
  127. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/elasticsearch.py +0 -0
  128. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/opensearch.py +0 -0
  129. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/presto.py +0 -0
  130. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/spark_df.py +0 -0
  131. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/databases/sybase.py +0 -0
  132. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/storage/__init__.py +0 -0
  133. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/storage/local_file.py +0 -0
  134. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/utils/__init__.py +0 -0
  135. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/integrations/utils/utils.py +0 -0
  136. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/__init__.py +0 -0
  137. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/dashboard.py +0 -0
  138. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/models.py +0 -0
  139. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/assets/fonts/DMSans-Bold.ttf +0 -0
  140. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/assets/fonts/DMSans-Medium.ttf +0 -0
  141. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/assets/fonts/DMSans-Regular.ttf +0 -0
  142. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/assets/fonts/DMSans-SemiBold.ttf +0 -0
  143. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/assets/images/docs.svg +0 -0
  144. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/assets/images/github.svg +0 -0
  145. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/assets/images/logo.svg +0 -0
  146. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/assets/images/slack.svg +0 -0
  147. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/index.js +0 -0
  148. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_core/report/static/index.js.LICENSE.txt +0 -0
  149. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/__init__.py +0 -0
  150. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/__main__.py +0 -0
  151. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/cli/__init__.py +0 -0
  152. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/cli/cli.py +0 -0
  153. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/__init__.py +0 -0
  154. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/config/__init__.py +0 -0
  155. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/config/config_loader.py +0 -0
  156. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/data_diff/__init__.py +0 -0
  157. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/data_diff/data_differ.py +0 -0
  158. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/rules/__init__.py +0 -0
  159. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/rules/rules_mappping.py +0 -0
  160. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/rules/rules_repository.py +0 -0
  161. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/rules/schema_rules.py +0 -0
  162. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/__init__.py +0 -0
  163. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/serializer.py +0 -0
  164. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/similarity_score/__init__.py +0 -0
  165. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/similarity_score/base_provider.py +0 -0
  166. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/similarity_score/cosine_similarity_provider.py +0 -0
  167. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/similarity_score/jaccard_provider.py +0 -0
  168. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/similarity_score/levenshtein_distance_provider.py +0 -0
  169. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/table.py +0 -0
  170. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/themes.py +0 -0
  171. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/sdk/utils/utils.py +0 -0
  172. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/dcs_sdk/utils/__init__.py +0 -0
  173. {dcs_sdk-2.2.3 → dcs_sdk-2.3.1}/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.1
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
@@ -199,7 +199,10 @@ class SQLDataSource(DataSource):
199
199
  def get_table_foreign_key_info(self, table_name: str, schema: str | None = None):
200
200
  """
201
201
  Return a table's foreign keys as a list of dicts with keys: constraint_name,
202
- table_name, fk_column, referenced_table, referenced_column.
202
+ table_name, fk_column, referenced_schema, referenced_table, referenced_column.
203
+ ``referenced_schema`` is the parent table's own schema, independent of the
204
+ child table's -- required so a caller can resolve a foreign key whose parent
205
+ lives in a different schema instead of assuming it shares the child's.
203
206
  Override in each datasource subclass. Default returns empty so a scan of an engine
204
207
  without FK introspection (or with no FK concept, e.g. Trino/Presto) doesn't fail -
205
208
  the foreign-key sync simply records none instead of raising.
@@ -1670,6 +1673,178 @@ class SQLDataSource(DataSource):
1670
1673
  reason=str(e).splitlines()[0][:300],
1671
1674
  ) from e
1672
1675
 
1676
+ # ------------------------------------------------------------------
1677
+ # Catalog lookup by name
1678
+ #
1679
+ # A whole-schema read (``get_code_objects``) answers "what is in the
1680
+ # schemas I scan". A lineage scan also has to answer a narrower question
1681
+ # about schemas it did NOT scan: a procedure calls ``dev.func_b`` -- does
1682
+ # ``dev.func_b`` exist, what is it, and what does its body read? That is
1683
+ # this call. It is keyed by name because the question arrives as a
1684
+ # reference written in someone else's code.
1685
+ # ------------------------------------------------------------------
1686
+
1687
+ #: Object kinds that carry a body. One of these coming back without its
1688
+ #: body is a gap to report; a table without one is not.
1689
+ _BODY_KINDS = frozenset(
1690
+ {"view", "materialized_view", "procedure", "function", "table_function", "trigger", "package", "package_body"}
1691
+ )
1692
+
1693
+ #: How this engine stores an unquoted identifier: ``"upper"`` where
1694
+ #: ``dev`` is catalogued as ``DEV``, ``"lower"`` where ``DEV`` is
1695
+ #: catalogued as ``dev``. A reference is usually written unquoted, so the
1696
+ #: lookup retries a schema in this case when the schema as written has
1697
+ #: nothing in it.
1698
+ _UNQUOTED_IDENTIFIER_CASE: Optional[str] = None
1699
+
1700
+ @property
1701
+ def supports_catalog_lookup(self) -> bool:
1702
+ """Whether :meth:`find_catalog_objects` can answer on this connector.
1703
+ False means it would raise :class:`EstateSurfaceUnavailableError`,
1704
+ so a caller can skip the attempt and record the gap once."""
1705
+ return hasattr(self, "query_get_table_names")
1706
+
1707
+ @staticmethod
1708
+ def _catalog_literal(value: str) -> str:
1709
+ """A quoted SQL string literal for an identifier.
1710
+
1711
+ The connector API takes SQL text, not bind parameters, so the value is
1712
+ escaped here. A NUL, a colon (SQLAlchemy's ``text()`` reads ``:name``
1713
+ as a bind parameter) and a backslash (an escape character in MySQL's
1714
+ default mode) are refused rather than escaped: no real identifier needs
1715
+ them, and an escape that is right for one driver is wrong for another.
1716
+ """
1717
+ if any(char in value for char in ("\x00", ":", "\\")):
1718
+ raise ValueError(f"refusing to look up identifier {value!r}")
1719
+ return "'" + value.replace("'", "''") + "'"
1720
+
1721
+ def find_catalog_objects(self, names: List[Tuple[str, str]]) -> Dict[Tuple[str, str], List[Dict[str, Any]]]:
1722
+ """Look up objects by ``(schema, name)``, in any schema, with their body.
1723
+
1724
+ Every requested pair is a key of the result. An empty list means the
1725
+ catalog has no such object -- a factual answer, not a failure. Several
1726
+ rows under one key are several objects: an overload, or a table and a
1727
+ function that share a name.
1728
+
1729
+ Names are matched as the catalog stores them first and, failing that,
1730
+ case-insensitively, because a reference is usually written unquoted
1731
+ (``dev.func_b``) while Oracle and Snowflake store ``DEV.FUNC_B``.
1732
+
1733
+ Each row has ``schema_name``, ``name``, ``object_kind``,
1734
+ ``definition``, ``definition_available`` and ``unreadable_reason``:
1735
+ ``None`` when the body was read or the kind has none, ``"permission"``
1736
+ when the login may not read it, ``"not_exposed"`` when the catalog does
1737
+ not return it (encrypted, compiled, secure, or not read by this
1738
+ connector). ``meta`` carries what the connector's
1739
+ :meth:`get_code_objects` carries (overload signatures).
1740
+
1741
+ This default reads each requested schema once through
1742
+ :meth:`query_get_table_names` and, where the connector has it,
1743
+ :meth:`get_code_objects`, so the cost is per schema, not per name.
1744
+ Connectors with a cheaper single-object read override it.
1745
+
1746
+ :raises EstateSurfaceUnavailableError: the connector cannot list a
1747
+ schema's objects at all, or a read failed.
1748
+ :raises ValueError: an identifier contains a character that cannot be
1749
+ put in SQL text safely.
1750
+ """
1751
+ if not self.supports_catalog_lookup:
1752
+ raise self._estate_surface_unsupported("catalog_lookup")
1753
+ result: Dict[Tuple[str, str], List[Dict[str, Any]]] = {(schema, name): [] for schema, name in names}
1754
+ by_schema: Dict[str, List[str]] = {}
1755
+ for schema, name in result:
1756
+ by_schema.setdefault(schema, []).append(name)
1757
+ for schema, wanted in by_schema.items():
1758
+ for name in wanted:
1759
+ self._catalog_literal(name)
1760
+ # Spellings are merged, not tried until one returns something: a
1761
+ # connector's code read may fold the schema itself (Oracle's does)
1762
+ # while its table listing does not, so the first spelling can
1763
+ # return code and no tables. A non-empty listing is the exact
1764
+ # schema, and ends the search.
1765
+ objects: List[Dict[str, Any]] = []
1766
+ seen: set = set()
1767
+ for spelling in self._schema_spellings(schema):
1768
+ found, listed_any = self._schema_catalog_objects(spelling)
1769
+ for obj in found:
1770
+ key = (obj["schema_name"], obj["name"], obj["object_kind"], str(obj.get("meta")))
1771
+ if key not in seen:
1772
+ seen.add(key)
1773
+ objects.append(obj)
1774
+ if listed_any:
1775
+ break
1776
+ for name in wanted:
1777
+ result[(schema, name)] = self._match_catalog_name(objects, name)
1778
+ return result
1779
+
1780
+ def _schema_spellings(self, schema: str) -> List[str]:
1781
+ """The schema as written, then as the engine folds an unquoted one.
1782
+ The connectors' own listings put the schema into SQL unescaped, so a
1783
+ quote in it is refused here as well as the characters
1784
+ :meth:`_catalog_literal` refuses."""
1785
+ self._catalog_literal(schema)
1786
+ if "'" in schema:
1787
+ raise ValueError(f"refusing to look up schema {schema!r}")
1788
+ folded = {"upper": schema.upper(), "lower": schema.lower()}.get(self._UNQUOTED_IDENTIFIER_CASE or "")
1789
+ return [schema] + ([folded] if folded and folded != schema else [])
1790
+
1791
+ def _schema_catalog_objects(self, schema: str) -> Tuple[List[Dict[str, Any]], bool]:
1792
+ """One schema's objects in the lookup's row shape: tables and views
1793
+ from the table listing, bodies from ``get_code_objects`` where the
1794
+ connector has it. The flag says whether the listing had anything."""
1795
+ try:
1796
+ listing = self.query_get_table_names(schema=schema, with_view=True) or {}
1797
+ except Exception as e: # noqa: BLE001 - re-raised as a typed surface error
1798
+ raise EstateSurfaceUnavailableError(
1799
+ f"Could not list schema '{schema}' on {self.data_source_name}",
1800
+ surface="catalog_lookup",
1801
+ reason=str(e).splitlines()[0][:300] if str(e) else type(e).__name__,
1802
+ ) from e
1803
+ listed: Dict[Tuple[str, str], Dict[str, Any]] = {}
1804
+ for kind in ("table", "view"):
1805
+ for table_name in listing.get(kind) or []:
1806
+ listed[(str(table_name), kind)] = self._catalog_row(schema, str(table_name), kind, None)
1807
+ listed_any = bool(listed)
1808
+ code: List[Dict[str, Any]] = []
1809
+ code_objects = getattr(self, "get_code_objects", None)
1810
+ for obj in (code_objects(schema) or []) if code_objects is not None else []:
1811
+ name, kind = obj.get("name"), obj.get("object_kind")
1812
+ if not name or not kind:
1813
+ continue
1814
+ row = self._catalog_row(obj.get("schema_name") or schema, str(name), kind, obj.get("definition"))
1815
+ meta = dict(obj.get("meta") or {})
1816
+ for key in ("argument_signature", "identity_arguments"):
1817
+ if obj.get(key) is not None:
1818
+ meta[key] = obj[key]
1819
+ if meta:
1820
+ row["meta"] = meta
1821
+ # The code read is the better record of a view: it has the body.
1822
+ # A table listing may also report a materialized view as a view.
1823
+ listed.pop((str(name), kind), None)
1824
+ if kind == "materialized_view":
1825
+ listed.pop((str(name), "view"), None)
1826
+ code.append(row)
1827
+ return list(listed.values()) + code, listed_any
1828
+
1829
+ def _catalog_row(self, schema: str, name: str, kind: str, definition: Optional[str]) -> Dict[str, Any]:
1830
+ has_body = kind in self._BODY_KINDS
1831
+ return {
1832
+ "schema_name": schema,
1833
+ "name": name,
1834
+ "object_kind": kind,
1835
+ "definition": definition,
1836
+ "definition_available": definition is not None,
1837
+ "unreadable_reason": "not_exposed" if has_body and definition is None else None,
1838
+ }
1839
+
1840
+ @staticmethod
1841
+ def _match_catalog_name(objects: List[Dict[str, Any]], name: str) -> List[Dict[str, Any]]:
1842
+ exact = [obj for obj in objects if obj["name"] == name]
1843
+ if exact:
1844
+ return exact
1845
+ folded = name.casefold()
1846
+ return [obj for obj in objects if obj["name"].casefold() == folded]
1847
+
1673
1848
  def get_security_principals(self, schema: str | None = None) -> Dict[str, List[Dict]]:
1674
1849
  """Roles, users/logins, role memberships and object-level grants.
1675
1850
 
@@ -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):
@@ -1480,11 +1480,12 @@ class MssqlDataSource(SQLDataSource):
1480
1480
  def get_table_foreign_key_info(self, table_name: str, schema: str | None = None):
1481
1481
  schema = schema or self.schema_name
1482
1482
 
1483
- query = f"""
1483
+ query = """
1484
1484
  SELECT
1485
1485
  fk.name AS constraint_name,
1486
1486
  t.name AS table_name,
1487
1487
  c.name AS fk_column,
1488
+ rs.name AS referenced_schema,
1488
1489
  rt.name AS referenced_table,
1489
1490
  rc.name AS referenced_column,
1490
1491
  fkc.constraint_column_id AS key_ordinal
@@ -1505,13 +1506,13 @@ class MssqlDataSource(SQLDataSource):
1505
1506
  INNER JOIN sys.columns rc
1506
1507
  ON fkc.referenced_object_id = rc.object_id
1507
1508
  AND fkc.referenced_column_id = rc.column_id
1508
- WHERE t.name = '{table_name}'
1509
- AND s.name = '{schema}'
1509
+ WHERE t.name = ?
1510
+ AND s.name = ?
1510
1511
  ORDER BY fk.name, fkc.constraint_column_id;
1511
1512
  """
1512
1513
  try:
1513
1514
  cursor = self.connection.cursor()
1514
- cursor.execute(query)
1515
+ cursor.execute(query, (table_name, schema))
1515
1516
  rows = cursor.fetchall()
1516
1517
  except Exception as e:
1517
1518
  logger.error(f"Failed to fetch fk info for dataset: {table_name} ({e})")
@@ -1522,9 +1523,10 @@ class MssqlDataSource(SQLDataSource):
1522
1523
  "constraint_name": row[0],
1523
1524
  "table_name": row[1],
1524
1525
  "fk_column": row[2],
1525
- "referenced_table": row[3],
1526
- "referenced_column": row[4],
1527
- "key_ordinal": row[5],
1526
+ "referenced_schema": row[3],
1527
+ "referenced_table": row[4],
1528
+ "referenced_column": row[5],
1529
+ "key_ordinal": row[6],
1528
1530
  }
1529
1531
  for row in rows
1530
1532
  ]
@@ -2562,6 +2564,58 @@ class MssqlDataSource(SQLDataSource):
2562
2564
  row["definition_available"] = row.get("definition") is not None
2563
2565
  return rows
2564
2566
 
2567
+ #: sys.objects types the catalog lookup reports, beyond the code kinds.
2568
+ _LOOKUP_TYPE_KINDS = {**_OBJECT_TYPE_KINDS, "U": "table", "SN": "synonym", "SO": "sequence"}
2569
+
2570
+ def find_catalog_objects(self, names: List[Tuple[str, str]]) -> Dict[Tuple[str, str], List[Dict[str, Any]]]:
2571
+ """One ``sys.objects`` read per name, so a reference into a schema
2572
+ that was never scanned costs one round-trip, not a schema read.
2573
+
2574
+ ``OBJECT_DEFINITION`` returns NULL both when the login lacks VIEW
2575
+ DEFINITION and when the module is encrypted or CLR-backed. The
2576
+ permission check asked alongside it tells the two apart, and they are
2577
+ reported differently: one is fixed by a grant, the other by nothing.
2578
+ A synonym carries the object it points at in ``meta``.
2579
+
2580
+ SQL Server hides an object from ``sys.objects`` entirely when the
2581
+ login holds no permission on it, so for such a login an existing
2582
+ object and an absent one both come back as an empty list.
2583
+ """
2584
+ result: Dict[Tuple[str, str], List[Dict[str, Any]]] = {}
2585
+ types = ", ".join(f"'{code}'" for code in sorted(self._LOOKUP_TYPE_KINDS))
2586
+ for schema, name in names:
2587
+ rows = self._estate_surface(
2588
+ "catalog_lookup",
2589
+ f"""
2590
+ SELECT s.name AS schema_name,
2591
+ o.name AS name,
2592
+ o.type AS sys_type,
2593
+ OBJECT_DEFINITION(o.object_id) AS definition,
2594
+ HAS_PERMS_BY_NAME(QUOTENAME(s.name) + '.' + QUOTENAME(o.name),
2595
+ 'OBJECT', 'VIEW DEFINITION') AS can_view_definition,
2596
+ sn.base_object_name
2597
+ FROM sys.objects o
2598
+ JOIN sys.schemas s ON s.schema_id = o.schema_id
2599
+ LEFT JOIN sys.synonyms sn ON sn.object_id = o.object_id
2600
+ WHERE s.name = N{self._catalog_literal(schema)}
2601
+ AND o.name = N{self._catalog_literal(name)}
2602
+ AND o.type IN ({types})
2603
+ AND o.is_ms_shipped = 0
2604
+ ORDER BY o.name, o.type
2605
+ """,
2606
+ )
2607
+ found = []
2608
+ for row in rows:
2609
+ kind = self._LOOKUP_TYPE_KINDS[(row.get("sys_type") or "").strip()]
2610
+ entry = self._catalog_row(row["schema_name"], row["name"], kind, row.get("definition"))
2611
+ if entry["unreadable_reason"] is not None and row.get("can_view_definition") == 0:
2612
+ entry["unreadable_reason"] = "permission"
2613
+ if row.get("base_object_name"):
2614
+ entry["meta"] = {"base_object_name": row["base_object_name"]}
2615
+ found.append(entry)
2616
+ result[(schema, name)] = found
2617
+ return result
2618
+
2565
2619
  def get_tier3_assets(self, schema: str | None = None) -> Dict[str, Any]:
2566
2620
  """The surrounding surface a translation must be aware of but cannot
2567
2621
  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