dbt-adapters 1.0.0b1__tar.gz → 1.0.0b2__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.

Potentially problematic release.


This version of dbt-adapters might be problematic. Click here for more details.

Files changed (155) hide show
  1. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/PKG-INFO +2 -2
  2. dbt_adapters-1.0.0b2/dbt/adapters/__about__.py +1 -0
  3. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/base/connections.py +6 -5
  4. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/base/impl.py +64 -46
  5. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/base/relation.py +2 -2
  6. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/contracts/relation.py +4 -0
  7. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/factory.py +1 -3
  8. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/protocol.py +5 -2
  9. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/relation_configs/config_base.py +5 -3
  10. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/sql/connections.py +10 -5
  11. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/sql/impl.py +13 -9
  12. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/materialized_view/drop.sql +1 -1
  13. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/table/drop.sql +1 -1
  14. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/view/drop.sql +1 -1
  15. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/pyproject.toml +1 -0
  16. dbt_adapters-1.0.0b1/dbt/adapters/__about__.py +0 -1
  17. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/.gitignore +0 -0
  18. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/LICENSE +0 -0
  19. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/README.md +0 -0
  20. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/__init__.py +0 -0
  21. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/__init__.py +0 -0
  22. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/base/README.md +0 -0
  23. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/base/__init__.py +0 -0
  24. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/base/column.py +0 -0
  25. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/base/meta.py +0 -0
  26. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/base/plugin.py +0 -0
  27. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/base/query_headers.py +0 -0
  28. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/cache.py +0 -0
  29. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/capability.py +0 -0
  30. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/clients/__init__.py +0 -0
  31. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/clients/jinja.py +0 -0
  32. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/contracts/__init__.py +0 -0
  33. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/contracts/connection.py +0 -0
  34. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/contracts/macros.py +0 -0
  35. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/events/README.md +0 -0
  36. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/events/__init__.py +0 -0
  37. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/events/adapter_types.proto +0 -0
  38. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/events/adapter_types_pb2.py +0 -0
  39. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/events/base_types.py +0 -0
  40. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/events/logging.py +0 -0
  41. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/events/types.py +0 -0
  42. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/exceptions/__init__.py +0 -0
  43. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/exceptions/alias.py +0 -0
  44. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/exceptions/cache.py +0 -0
  45. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/exceptions/compilation.py +0 -0
  46. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/exceptions/connection.py +0 -0
  47. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/exceptions/database.py +0 -0
  48. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/py.typed +0 -0
  49. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/reference_keys.py +0 -0
  50. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/relation_configs/README.md +0 -0
  51. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/relation_configs/__init__.py +0 -0
  52. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/relation_configs/config_change.py +0 -0
  53. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/relation_configs/config_validation.py +0 -0
  54. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/sql/__init__.py +0 -0
  55. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/adapters/utils.py +0 -0
  56. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/__init__.py +0 -0
  57. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/__init__.py +0 -0
  58. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/dbt_project.yml +0 -0
  59. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/docs/overview.md +0 -0
  60. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/apply_grants.sql +0 -0
  61. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/columns.sql +0 -0
  62. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/freshness.sql +0 -0
  63. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/indexes.sql +0 -0
  64. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/metadata.sql +0 -0
  65. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/persist_docs.sql +0 -0
  66. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/relation.sql +0 -0
  67. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/schema.sql +0 -0
  68. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/show.sql +0 -0
  69. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/timestamps.sql +0 -0
  70. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/adapters/validate_sql.sql +0 -0
  71. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/etc/datetime.sql +0 -0
  72. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/etc/statement.sql +0 -0
  73. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/generic_test_sql/accepted_values.sql +0 -0
  74. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/generic_test_sql/not_null.sql +0 -0
  75. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/generic_test_sql/relationships.sql +0 -0
  76. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/generic_test_sql/unique.sql +0 -0
  77. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/get_custom_name/get_custom_alias.sql +0 -0
  78. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/get_custom_name/get_custom_database.sql +0 -0
  79. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/get_custom_name/get_custom_schema.sql +0 -0
  80. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/configs.sql +0 -0
  81. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/hooks.sql +0 -0
  82. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/clone/can_clone_table.sql +0 -0
  83. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/clone/clone.sql +0 -0
  84. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/clone/create_or_replace_clone.sql +0 -0
  85. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/incremental/column_helpers.sql +0 -0
  86. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/incremental/incremental.sql +0 -0
  87. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/incremental/is_incremental.sql +0 -0
  88. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/incremental/merge.sql +0 -0
  89. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/incremental/on_schema_change.sql +0 -0
  90. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/incremental/strategies.sql +0 -0
  91. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/materialized_view.sql +0 -0
  92. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/table.sql +0 -0
  93. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/models/view.sql +0 -0
  94. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/seeds/helpers.sql +0 -0
  95. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/seeds/seed.sql +0 -0
  96. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/snapshots/helpers.sql +0 -0
  97. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/snapshots/snapshot.sql +0 -0
  98. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/snapshots/snapshot_merge.sql +0 -0
  99. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/snapshots/strategies.sql +0 -0
  100. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/tests/helpers.sql +0 -0
  101. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/tests/test.sql +0 -0
  102. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/tests/unit.sql +0 -0
  103. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/materializations/tests/where_subquery.sql +0 -0
  104. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/python_model/python.sql +0 -0
  105. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/column/columns_spec_ddl.sql +0 -0
  106. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/create.sql +0 -0
  107. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/create_backup.sql +0 -0
  108. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/create_intermediate.sql +0 -0
  109. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/drop.sql +0 -0
  110. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/drop_backup.sql +0 -0
  111. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/materialized_view/alter.sql +0 -0
  112. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/materialized_view/create.sql +0 -0
  113. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/materialized_view/refresh.sql +0 -0
  114. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/materialized_view/rename.sql +0 -0
  115. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/materialized_view/replace.sql +0 -0
  116. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/rename.sql +0 -0
  117. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/rename_intermediate.sql +0 -0
  118. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/replace.sql +0 -0
  119. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/schema.sql +0 -0
  120. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/table/create.sql +0 -0
  121. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/table/rename.sql +0 -0
  122. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/table/replace.sql +0 -0
  123. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/view/create.sql +0 -0
  124. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/view/rename.sql +0 -0
  125. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/relations/view/replace.sql +0 -0
  126. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/unit_test_sql/get_fixture_sql.sql +0 -0
  127. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/any_value.sql +0 -0
  128. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/array_append.sql +0 -0
  129. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/array_concat.sql +0 -0
  130. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/array_construct.sql +0 -0
  131. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/bool_or.sql +0 -0
  132. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/cast.sql +0 -0
  133. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/cast_bool_to_text.sql +0 -0
  134. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/concat.sql +0 -0
  135. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/data_types.sql +0 -0
  136. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/date_spine.sql +0 -0
  137. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/date_trunc.sql +0 -0
  138. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/dateadd.sql +0 -0
  139. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/datediff.sql +0 -0
  140. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/escape_single_quotes.sql +0 -0
  141. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/except.sql +0 -0
  142. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/generate_series.sql +0 -0
  143. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/hash.sql +0 -0
  144. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/intersect.sql +0 -0
  145. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/last_day.sql +0 -0
  146. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/length.sql +0 -0
  147. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/listagg.sql +0 -0
  148. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/literal.sql +0 -0
  149. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/position.sql +0 -0
  150. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/replace.sql +0 -0
  151. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/right.sql +0 -0
  152. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/safe_cast.sql +0 -0
  153. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/macros/utils/split_part.sql +0 -0
  154. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/global_project/tests/generic/builtin.sql +0 -0
  155. {dbt_adapters-1.0.0b1 → dbt_adapters-1.0.0b2}/dbt/include/py.typed +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: dbt-adapters
3
- Version: 1.0.0b1
3
+ Version: 1.0.0b2
4
4
  Summary: The set of adapter protocols and base functionality that supports integration with dbt-core
5
5
  Project-URL: Homepage, https://github.com/dbt-labs/dbt-adapters
6
6
  Project-URL: Documentation, https://docs.getdbt.com
@@ -0,0 +1 @@
1
+ version = "1.0.0b2"
@@ -18,9 +18,9 @@ from typing import (
18
18
  Tuple,
19
19
  Type,
20
20
  Union,
21
+ TYPE_CHECKING,
21
22
  )
22
23
 
23
- import agate
24
24
  from dbt_common.events.contextvars import get_node_info
25
25
  from dbt_common.events.functions import fire_event
26
26
  from dbt_common.exceptions import DbtInternalError, NotImplementedError
@@ -48,6 +48,9 @@ from dbt.adapters.events.types import (
48
48
  )
49
49
  from dbt.adapters.exceptions import FailedToConnectError, InvalidConnectionError
50
50
 
51
+ if TYPE_CHECKING:
52
+ import agate
53
+
51
54
 
52
55
  SleepTime = Union[int, float] # As taken by time.sleep.
53
56
  AdapterHandle = Any # Adapter connection handle objects can be any class.
@@ -162,9 +165,7 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
162
165
  conn.handle = LazyHandle(self.open)
163
166
  # Add the connection to thread_connections for this thread
164
167
  self.set_thread_connection(conn)
165
- fire_event(
166
- NewConnection(conn_name=conn_name, conn_type=self.TYPE, node_info=get_node_info())
167
- )
168
+ fire_event(NewConnection(conn_name=conn_name, conn_type=self.TYPE, node_info=get_node_info()))
168
169
  else: # existing connection either wasn't open or didn't have the right name
169
170
  if conn.state != "open":
170
171
  conn.handle = LazyHandle(self.open)
@@ -396,7 +397,7 @@ class BaseConnectionManager(metaclass=abc.ABCMeta):
396
397
  auto_begin: bool = False,
397
398
  fetch: bool = False,
398
399
  limit: Optional[int] = None,
399
- ) -> Tuple[AdapterResponse, agate.Table]:
400
+ ) -> Tuple[AdapterResponse, "agate.Table"]:
400
401
  """Execute the given SQL.
401
402
 
402
403
  :param str sql: The sql to execute.
@@ -20,16 +20,9 @@ from typing import (
20
20
  Type,
21
21
  TypedDict,
22
22
  Union,
23
+ TYPE_CHECKING,
23
24
  )
24
25
 
25
- import agate
26
- from dbt_common.clients.agate_helper import (
27
- Integer,
28
- empty_table,
29
- get_column_value_uncased,
30
- merge_tables,
31
- table_from_rows,
32
- )
33
26
  from dbt_common.clients.jinja import CallableMacroGenerator
34
27
  from dbt_common.contracts.constraints import (
35
28
  ColumnLevelConstraint,
@@ -94,6 +87,9 @@ from dbt.adapters.exceptions import (
94
87
  )
95
88
  from dbt.adapters.protocol import AdapterConfig, MacroContextGeneratorCallable
96
89
 
90
+ if TYPE_CHECKING:
91
+ import agate
92
+
97
93
 
98
94
  GET_CATALOG_MACRO_NAME = "get_catalog"
99
95
  GET_CATALOG_RELATIONS_MACRO_NAME = "get_catalog_relations"
@@ -107,7 +103,14 @@ class ConstraintSupport(str, Enum):
107
103
  NOT_SUPPORTED = "not_supported"
108
104
 
109
105
 
110
- def _expect_row_value(key: str, row: agate.Row):
106
+ def _parse_callback_empty_table(*args, **kwargs) -> Tuple[str, "agate.Table"]:
107
+ # Lazy load agate_helper to avoid importing agate when it is not necessary.
108
+ from dbt_common.clients.agate_helper import empty_table
109
+
110
+ return "", empty_table()
111
+
112
+
113
+ def _expect_row_value(key: str, row: "agate.Row"):
111
114
  if key not in row.keys():
112
115
  raise DbtInternalError(
113
116
  'Got a row without "{}" column, columns: {}'.format(key, row.keys())
@@ -117,13 +120,13 @@ def _expect_row_value(key: str, row: agate.Row):
117
120
 
118
121
  def _catalog_filter_schemas(
119
122
  used_schemas: FrozenSet[Tuple[str, str]]
120
- ) -> Callable[[agate.Row], bool]:
123
+ ) -> Callable[["agate.Row"], bool]:
121
124
  """Return a function that takes a row and decides if the row should be
122
125
  included in the catalog output.
123
126
  """
124
127
  schemas = frozenset((d.lower(), s.lower()) for d, s in used_schemas)
125
128
 
126
- def test(row: agate.Row) -> bool:
129
+ def test(row: "agate.Row") -> bool:
127
130
  table_database = _expect_row_value("table_database", row)
128
131
  table_schema = _expect_row_value("table_schema", row)
129
132
  # the schema may be present but None, which is not an error and should
@@ -254,6 +257,8 @@ class BaseAdapter(metaclass=AdapterMeta):
254
257
  ConstraintType.foreign_key: ConstraintSupport.ENFORCED,
255
258
  }
256
259
 
260
+ MAX_SCHEMA_METADATA_RELATIONS = 100
261
+
257
262
  # This static member variable can be overriden in concrete adapter
258
263
  # implementations to indicate adapter support for optional capabilities.
259
264
  _capabilities = CapabilityDict({})
@@ -323,14 +328,14 @@ class BaseAdapter(metaclass=AdapterMeta):
323
328
  if self.connections.query_header is not None:
324
329
  self.connections.query_header.reset()
325
330
 
326
- @available.parse(lambda *a, **k: ("", empty_table()))
331
+ @available.parse(_parse_callback_empty_table)
327
332
  def execute(
328
333
  self,
329
334
  sql: str,
330
335
  auto_begin: bool = False,
331
336
  fetch: bool = False,
332
337
  limit: Optional[int] = None,
333
- ) -> Tuple[AdapterResponse, agate.Table]:
338
+ ) -> Tuple[AdapterResponse, "agate.Table"]:
334
339
  """Execute the given SQL. This is a thin wrapper around
335
340
  ConnectionManager.execute.
336
341
 
@@ -340,7 +345,7 @@ class BaseAdapter(metaclass=AdapterMeta):
340
345
  :param bool fetch: If set, fetch results.
341
346
  :param Optional[int] limit: If set, only fetch n number of rows
342
347
  :return: A tuple of the query status and results (empty if fetch=False).
343
- :rtype: Tuple[AdapterResponse, agate.Table]
348
+ :rtype: Tuple[AdapterResponse, "agate.Table"]
344
349
  """
345
350
  return self.connections.execute(sql=sql, auto_begin=auto_begin, fetch=fetch, limit=limit)
346
351
 
@@ -368,8 +373,8 @@ class BaseAdapter(metaclass=AdapterMeta):
368
373
  ]
369
374
  return columns
370
375
 
371
- @available.parse(lambda *a, **k: ("", empty_table()))
372
- def get_partitions_metadata(self, table: str) -> Tuple[agate.Table]:
376
+ @available.parse(_parse_callback_empty_table)
377
+ def get_partitions_metadata(self, table: str) -> Tuple["agate.Table"]:
373
378
  """
374
379
  TODO: Can we move this to dbt-bigquery?
375
380
  Obtain partitions metadata for a BigQuery partitioned table.
@@ -377,7 +382,7 @@ class BaseAdapter(metaclass=AdapterMeta):
377
382
  :param str table: a partitioned table id, in standard SQL format.
378
383
  :return: a partition metadata tuple, as described in
379
384
  https://cloud.google.com/bigquery/docs/creating-partitioned-tables#getting_partition_metadata_using_meta_tables.
380
- :rtype: agate.Table
385
+ :rtype: "agate.Table"
381
386
  """
382
387
  if hasattr(self.connections, "get_partitions_metadata"):
383
388
  return self.connections.get_partitions_metadata(table=table)
@@ -421,7 +426,9 @@ class BaseAdapter(metaclass=AdapterMeta):
421
426
  populate.
422
427
  """
423
428
  return {
424
- self.Relation.create_from(quoting=self.config, relation_config=relation_config).without_identifier()
429
+ self.Relation.create_from(
430
+ quoting=self.config, relation_config=relation_config
431
+ ).without_identifier()
425
432
  for relation_config in relation_configs
426
433
  }
427
434
 
@@ -663,7 +670,7 @@ class BaseAdapter(metaclass=AdapterMeta):
663
670
  # Methods about grants
664
671
  ###
665
672
  @available
666
- def standardize_grants_dict(self, grants_table: agate.Table) -> dict:
673
+ def standardize_grants_dict(self, grants_table: "agate.Table") -> dict:
667
674
  """Translate the result of `show grants` (or equivalent) to match the
668
675
  grants which a user would configure in their project.
669
676
 
@@ -938,7 +945,7 @@ class BaseAdapter(metaclass=AdapterMeta):
938
945
  ###
939
946
  @classmethod
940
947
  @abc.abstractmethod
941
- def convert_text_type(cls, agate_table: agate.Table, col_idx: int) -> str:
948
+ def convert_text_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
942
949
  """Return the type in the database that best maps to the agate.Text
943
950
  type for the given agate table and column index.
944
951
 
@@ -950,7 +957,7 @@ class BaseAdapter(metaclass=AdapterMeta):
950
957
 
951
958
  @classmethod
952
959
  @abc.abstractmethod
953
- def convert_number_type(cls, agate_table: agate.Table, col_idx: int) -> str:
960
+ def convert_number_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
954
961
  """Return the type in the database that best maps to the agate.Number
955
962
  type for the given agate table and column index.
956
963
 
@@ -961,7 +968,7 @@ class BaseAdapter(metaclass=AdapterMeta):
961
968
  raise NotImplementedError("`convert_number_type` is not implemented for this adapter!")
962
969
 
963
970
  @classmethod
964
- def convert_integer_type(cls, agate_table: agate.Table, col_idx: int) -> str:
971
+ def convert_integer_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
965
972
  """Return the type in the database that best maps to the agate.Number
966
973
  type for the given agate table and column index.
967
974
 
@@ -973,7 +980,7 @@ class BaseAdapter(metaclass=AdapterMeta):
973
980
 
974
981
  @classmethod
975
982
  @abc.abstractmethod
976
- def convert_boolean_type(cls, agate_table: agate.Table, col_idx: int) -> str:
983
+ def convert_boolean_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
977
984
  """Return the type in the database that best maps to the agate.Boolean
978
985
  type for the given agate table and column index.
979
986
 
@@ -985,7 +992,7 @@ class BaseAdapter(metaclass=AdapterMeta):
985
992
 
986
993
  @classmethod
987
994
  @abc.abstractmethod
988
- def convert_datetime_type(cls, agate_table: agate.Table, col_idx: int) -> str:
995
+ def convert_datetime_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
989
996
  """Return the type in the database that best maps to the agate.DateTime
990
997
  type for the given agate table and column index.
991
998
 
@@ -997,7 +1004,7 @@ class BaseAdapter(metaclass=AdapterMeta):
997
1004
 
998
1005
  @classmethod
999
1006
  @abc.abstractmethod
1000
- def convert_date_type(cls, agate_table: agate.Table, col_idx: int) -> str:
1007
+ def convert_date_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
1001
1008
  """Return the type in the database that best maps to the agate.Date
1002
1009
  type for the given agate table and column index.
1003
1010
 
@@ -1009,7 +1016,7 @@ class BaseAdapter(metaclass=AdapterMeta):
1009
1016
 
1010
1017
  @classmethod
1011
1018
  @abc.abstractmethod
1012
- def convert_time_type(cls, agate_table: agate.Table, col_idx: int) -> str:
1019
+ def convert_time_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
1013
1020
  """Return the type in the database that best maps to the
1014
1021
  agate.TimeDelta type for the given agate table and column index.
1015
1022
 
@@ -1021,11 +1028,14 @@ class BaseAdapter(metaclass=AdapterMeta):
1021
1028
 
1022
1029
  @available
1023
1030
  @classmethod
1024
- def convert_type(cls, agate_table: agate.Table, col_idx: int) -> Optional[str]:
1031
+ def convert_type(cls, agate_table: "agate.Table", col_idx: int) -> Optional[str]:
1025
1032
  return cls.convert_agate_type(agate_table, col_idx)
1026
1033
 
1027
1034
  @classmethod
1028
- def convert_agate_type(cls, agate_table: agate.Table, col_idx: int) -> Optional[str]:
1035
+ def convert_agate_type(cls, agate_table: "agate.Table", col_idx: int) -> Optional[str]:
1036
+ import agate
1037
+ from dbt_common.clients.agate_helper import Integer
1038
+
1029
1039
  agate_type: Type = agate_table.column_types[col_idx]
1030
1040
  conversions: List[Tuple[Type, Callable[..., str]]] = [
1031
1041
  (Integer, cls.convert_integer_type),
@@ -1102,11 +1112,13 @@ class BaseAdapter(metaclass=AdapterMeta):
1102
1112
 
1103
1113
  @classmethod
1104
1114
  def _catalog_filter_table(
1105
- cls, table: agate.Table, used_schemas: FrozenSet[Tuple[str, str]]
1106
- ) -> agate.Table:
1115
+ cls, table: "agate.Table", used_schemas: FrozenSet[Tuple[str, str]]
1116
+ ) -> "agate.Table":
1107
1117
  """Filter the table as appropriate for catalog entries. Subclasses can
1108
1118
  override this to change filtering rules on a per-adapter basis.
1109
1119
  """
1120
+ from dbt_common.clients.agate_helper import table_from_rows
1121
+
1110
1122
  # force database + schema to be strings
1111
1123
  table = table_from_rows(
1112
1124
  table.rows,
@@ -1120,7 +1132,7 @@ class BaseAdapter(metaclass=AdapterMeta):
1120
1132
  information_schema: InformationSchema,
1121
1133
  schemas: Set[str],
1122
1134
  used_schemas: FrozenSet[Tuple[str, str]],
1123
- ) -> agate.Table:
1135
+ ) -> "agate.Table":
1124
1136
  kwargs = {"information_schema": information_schema, "schemas": schemas}
1125
1137
  table = self.execute_macro(GET_CATALOG_MACRO_NAME, kwargs=kwargs)
1126
1138
 
@@ -1132,7 +1144,7 @@ class BaseAdapter(metaclass=AdapterMeta):
1132
1144
  information_schema: InformationSchema,
1133
1145
  relations: List[BaseRelation],
1134
1146
  used_schemas: FrozenSet[Tuple[str, str]],
1135
- ) -> agate.Table:
1147
+ ) -> "agate.Table":
1136
1148
  kwargs = {
1137
1149
  "information_schema": information_schema,
1138
1150
  "relations": relations,
@@ -1148,10 +1160,10 @@ class BaseAdapter(metaclass=AdapterMeta):
1148
1160
  used_schemas: FrozenSet[Tuple[str, str]],
1149
1161
  relations: Optional[Set[BaseRelation]] = None,
1150
1162
  ):
1151
- catalogs: agate.Table
1163
+ catalogs: "agate.Table"
1152
1164
  if (
1153
1165
  relations is None
1154
- or len(relations) > 100
1166
+ or len(relations) > self.MAX_SCHEMA_METADATA_RELATIONS
1155
1167
  or not self.supports(Capability.SchemaMetadataByRelations)
1156
1168
  ):
1157
1169
  # Do it the traditional way. We get the full catalog.
@@ -1171,7 +1183,7 @@ class BaseAdapter(metaclass=AdapterMeta):
1171
1183
  for r in relations
1172
1184
  }
1173
1185
 
1174
- def in_map(row: agate.Row):
1186
+ def in_map(row: "agate.Row"):
1175
1187
  d = _expect_row_value("table_database", row)
1176
1188
  s = _expect_row_value("table_schema", row)
1177
1189
  i = _expect_row_value("table_name", row)
@@ -1184,16 +1196,16 @@ class BaseAdapter(metaclass=AdapterMeta):
1184
1196
 
1185
1197
  return catalogs, exceptions
1186
1198
 
1187
- def row_matches_relation(self, row: agate.Row, relations: Set[BaseRelation]):
1199
+ def row_matches_relation(self, row: "agate.Row", relations: Set[BaseRelation]):
1188
1200
  pass
1189
1201
 
1190
1202
  def get_catalog(
1191
1203
  self,
1192
1204
  relation_configs: Iterable[RelationConfig],
1193
1205
  used_schemas: FrozenSet[Tuple[str, str]],
1194
- ) -> Tuple[agate.Table, List[Exception]]:
1206
+ ) -> Tuple["agate.Table", List[Exception]]:
1195
1207
  with executor(self.config) as tpe:
1196
- futures: List[Future[agate.Table]] = []
1208
+ futures: List[Future["agate.Table"]] = []
1197
1209
  schema_map: SchemaSearchMap = self._get_catalog_schemas(relation_configs)
1198
1210
  for info, schemas in schema_map.items():
1199
1211
  if len(schemas) == 0:
@@ -1209,9 +1221,9 @@ class BaseAdapter(metaclass=AdapterMeta):
1209
1221
 
1210
1222
  def get_catalog_by_relations(
1211
1223
  self, used_schemas: FrozenSet[Tuple[str, str]], relations: Set[BaseRelation]
1212
- ) -> Tuple[agate.Table, List[Exception]]:
1224
+ ) -> Tuple["agate.Table", List[Exception]]:
1213
1225
  with executor(self.config) as tpe:
1214
- futures: List[Future[agate.Table]] = []
1226
+ futures: List[Future["agate.Table"]] = []
1215
1227
  relations_by_schema = self._get_catalog_relations_by_info_schema(relations)
1216
1228
  for info_schema in relations_by_schema:
1217
1229
  name = ".".join([str(info_schema.database), "information_schema"])
@@ -1241,6 +1253,8 @@ class BaseAdapter(metaclass=AdapterMeta):
1241
1253
  macro_resolver: Optional[MacroResolverProtocol] = None,
1242
1254
  ) -> Tuple[Optional[AdapterResponse], FreshnessResponse]:
1243
1255
  """Calculate the freshness of sources in dbt, and return it"""
1256
+ import agate
1257
+
1244
1258
  kwargs: Dict[str, Any] = {
1245
1259
  "source": source,
1246
1260
  "loaded_at_field": loaded_at_field,
@@ -1251,8 +1265,8 @@ class BaseAdapter(metaclass=AdapterMeta):
1251
1265
  # in older versions of dbt-core, the 'collect_freshness' macro returned the table of results directly
1252
1266
  # starting in v1.5, by default, we return both the table and the adapter response (metadata about the query)
1253
1267
  result: Union[
1254
- AttrDict, # current: contains AdapterResponse + agate.Table
1255
- agate.Table, # previous: just table
1268
+ AttrDict, # current: contains AdapterResponse + "agate.Table"
1269
+ "agate.Table", # previous: just table
1256
1270
  ]
1257
1271
  result = self.execute_macro(
1258
1272
  FRESHNESS_MACRO_NAME, kwargs=kwargs, macro_resolver=macro_resolver
@@ -1300,6 +1314,8 @@ class BaseAdapter(metaclass=AdapterMeta):
1300
1314
  adapter_response, table = result.response, result.table # type: ignore[attr-defined]
1301
1315
 
1302
1316
  try:
1317
+ from dbt_common.clients.agate_helper import get_column_value_uncased
1318
+
1303
1319
  row = table[0]
1304
1320
  last_modified_val = get_column_value_uncased("last_modified", row)
1305
1321
  snapshotted_at_val = get_column_value_uncased("snapshotted_at", row)
@@ -1636,10 +1652,12 @@ join diff_count using (id)
1636
1652
 
1637
1653
 
1638
1654
  def catch_as_completed(
1639
- futures, # typing: List[Future[agate.Table]]
1640
- ) -> Tuple[agate.Table, List[Exception]]:
1641
- # catalogs: agate.Table = agate.Table(rows=[])
1642
- tables: List[agate.Table] = []
1655
+ futures, # typing: List[Future["agate.Table"]]
1656
+ ) -> Tuple["agate.Table", List[Exception]]:
1657
+ from dbt_common.clients.agate_helper import merge_tables
1658
+
1659
+ # catalogs: "agate.Table" =".Table(rows=[])
1660
+ tables: List["agate.Table"] = []
1643
1661
  exceptions: List[Exception] = []
1644
1662
 
1645
1663
  for future in as_completed(futures):
@@ -52,13 +52,13 @@ class BaseRelation(FakeAPIObject, Hashable):
52
52
  # adding a relation type here also requires defining the associated rename macro
53
53
  # e.g. adding RelationType.View in dbt-postgres requires that you define:
54
54
  # include/postgres/macros/relations/view/rename.sql::postgres__get_rename_view_sql()
55
- renameable_relations: SerializableIterable = ()
55
+ renameable_relations: SerializableIterable = field(default_factory=frozenset)
56
56
 
57
57
  # register relation types that are atomically replaceable, e.g. they have "create or replace" syntax
58
58
  # adding a relation type here also requires defining the associated replace macro
59
59
  # e.g. adding RelationType.View in dbt-postgres requires that you define:
60
60
  # include/postgres/macros/relations/view/replace.sql::postgres__get_replace_view_sql()
61
- replaceable_relations: SerializableIterable = ()
61
+ replaceable_relations: SerializableIterable = field(default_factory=frozenset)
62
62
 
63
63
  def _is_exactish_match(self, field: ComponentName, value: str) -> bool:
64
64
  if self.dbt_created and self.quote_policy.get_part(field) is False:
@@ -48,11 +48,15 @@ class MaterializationConfig(Mapping, ABC):
48
48
 
49
49
 
50
50
  class RelationConfig(Protocol):
51
+ resource_type: str
51
52
  name: str
53
+ description: str
52
54
  database: str
53
55
  schema: str
54
56
  identifier: str
55
57
  compiled_code: Optional[str]
58
+ meta: Dict[str, Any]
59
+ tags: List[str]
56
60
  quoting_dict: Dict[str, bool]
57
61
  config: Optional[MaterializationConfig]
58
62
 
@@ -100,9 +100,7 @@ class AdapterContainer:
100
100
  adapter_name = config.credentials.type
101
101
  adapter_type = self.get_adapter_class_by_name(adapter_name)
102
102
  adapter_version = self._adapter_version(adapter_name)
103
- fire_event(
104
- AdapterRegistered(adapter_name=adapter_name, adapter_version=adapter_version)
105
- )
103
+ fire_event(AdapterRegistered(adapter_name=adapter_name, adapter_version=adapter_version))
106
104
  with self.lock:
107
105
  if adapter_name in self.adapters:
108
106
  # this shouldn't really happen...
@@ -10,10 +10,10 @@ from typing import (
10
10
  Type,
11
11
  TypeVar,
12
12
  Tuple,
13
+ TYPE_CHECKING,
13
14
  )
14
15
  from typing_extensions import Protocol
15
16
 
16
- import agate
17
17
  from dbt_common.clients.jinja import MacroProtocol
18
18
  from dbt_common.contracts.config.base import BaseConfig
19
19
 
@@ -25,6 +25,9 @@ from dbt.adapters.contracts.connection import (
25
25
  from dbt.adapters.contracts.macros import MacroResolverProtocol
26
26
  from dbt.adapters.contracts.relation import HasQuoting, Policy, RelationConfig
27
27
 
28
+ if TYPE_CHECKING:
29
+ import agate
30
+
28
31
 
29
32
  @dataclass
30
33
  class AdapterConfig(BaseConfig):
@@ -169,5 +172,5 @@ class AdapterProtocol( # type: ignore[misc]
169
172
 
170
173
  def execute(
171
174
  self, sql: str, auto_begin: bool = False, fetch: bool = False
172
- ) -> Tuple[AdapterResponse, agate.Table]:
175
+ ) -> Tuple[AdapterResponse, "agate.Table"]:
173
176
  ...
@@ -1,9 +1,11 @@
1
1
  from dataclasses import dataclass
2
- from typing import Dict, Union
2
+ from typing import Dict, Union, TYPE_CHECKING
3
3
 
4
- import agate
5
4
  from dbt_common.utils import filter_null_values
6
5
 
6
+ if TYPE_CHECKING:
7
+ import agate
8
+
7
9
 
8
10
  """
9
11
  This is what relation metadata from the database looks like. It's a dictionary because there will be
@@ -18,7 +20,7 @@ like name. But it also can have multiple indexes, which needs to be a separate q
18
20
  ])
19
21
  }
20
22
  """
21
- RelationResults = Dict[str, Union[agate.Row, agate.Table]]
23
+ RelationResults = Dict[str, Union["agate.Row", "agate.Table"]]
22
24
 
23
25
 
24
26
  @dataclass(frozen=True)
@@ -1,9 +1,7 @@
1
1
  import abc
2
2
  import time
3
- from typing import Any, Dict, Iterable, List, Optional, Tuple
3
+ from typing import Any, Dict, Iterable, List, Optional, Tuple, TYPE_CHECKING
4
4
 
5
- import agate
6
- from dbt_common.clients.agate_helper import empty_table, table_from_data_flat
7
5
  from dbt_common.events.contextvars import get_node_info
8
6
  from dbt_common.events.functions import fire_event
9
7
  from dbt_common.exceptions import DbtInternalError, NotImplementedError
@@ -22,6 +20,9 @@ from dbt.adapters.events.types import (
22
20
  SQLQueryStatus,
23
21
  )
24
22
 
23
+ if TYPE_CHECKING:
24
+ import agate
25
+
25
26
 
26
27
  class SQLConnectionManager(BaseConnectionManager):
27
28
  """The default connection manager with some common SQL methods implemented.
@@ -126,7 +127,9 @@ class SQLConnectionManager(BaseConnectionManager):
126
127
  return [dict(zip(column_names, row)) for row in rows]
127
128
 
128
129
  @classmethod
129
- def get_result_from_cursor(cls, cursor: Any, limit: Optional[int]) -> agate.Table:
130
+ def get_result_from_cursor(cls, cursor: Any, limit: Optional[int]) -> "agate.Table":
131
+ from dbt_common.clients.agate_helper import table_from_data_flat
132
+
130
133
  data: List[Any] = []
131
134
  column_names: List[str] = []
132
135
 
@@ -146,7 +149,9 @@ class SQLConnectionManager(BaseConnectionManager):
146
149
  auto_begin: bool = False,
147
150
  fetch: bool = False,
148
151
  limit: Optional[int] = None,
149
- ) -> Tuple[AdapterResponse, agate.Table]:
152
+ ) -> Tuple[AdapterResponse, "agate.Table"]:
153
+ from dbt_common.clients.agate_helper import empty_table
154
+
150
155
  sql = self._add_query_comment(sql)
151
156
  _, cursor = self.add_query(sql, auto_begin)
152
157
  response = self.get_response(cursor)
@@ -1,6 +1,5 @@
1
- from typing import Any, List, Optional, Tuple, Type
1
+ from typing import Any, List, Optional, Tuple, Type, TYPE_CHECKING
2
2
 
3
- import agate
4
3
  from dbt_common.events.functions import fire_event
5
4
 
6
5
  from dbt.adapters.base import BaseAdapter, BaseRelation, available
@@ -23,6 +22,9 @@ DROP_RELATION_MACRO_NAME = "drop_relation"
23
22
  ALTER_COLUMN_TYPE_MACRO_NAME = "alter_column_type"
24
23
  VALIDATE_SQL_MACRO_NAME = "validate_sql"
25
24
 
25
+ if TYPE_CHECKING:
26
+ import agate
27
+
26
28
 
27
29
  class SQLAdapter(BaseAdapter):
28
30
  """The default adapter with the common agate conversions and some SQL
@@ -65,33 +67,35 @@ class SQLAdapter(BaseAdapter):
65
67
  return self.connections.add_query(sql, auto_begin, bindings, abridge_sql_log)
66
68
 
67
69
  @classmethod
68
- def convert_text_type(cls, agate_table: agate.Table, col_idx: int) -> str:
70
+ def convert_text_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
69
71
  return "text"
70
72
 
71
73
  @classmethod
72
- def convert_number_type(cls, agate_table: agate.Table, col_idx: int) -> str:
74
+ def convert_number_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
75
+ import agate
76
+
73
77
  # TODO CT-211
74
78
  decimals = agate_table.aggregate(agate.MaxPrecision(col_idx)) # type: ignore[attr-defined]
75
79
  return "float8" if decimals else "integer"
76
80
 
77
81
  @classmethod
78
- def convert_integer_type(cls, agate_table: agate.Table, col_idx: int) -> str:
82
+ def convert_integer_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
79
83
  return "integer"
80
84
 
81
85
  @classmethod
82
- def convert_boolean_type(cls, agate_table: agate.Table, col_idx: int) -> str:
86
+ def convert_boolean_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
83
87
  return "boolean"
84
88
 
85
89
  @classmethod
86
- def convert_datetime_type(cls, agate_table: agate.Table, col_idx: int) -> str:
90
+ def convert_datetime_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
87
91
  return "timestamp without time zone"
88
92
 
89
93
  @classmethod
90
- def convert_date_type(cls, agate_table: agate.Table, col_idx: int) -> str:
94
+ def convert_date_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
91
95
  return "date"
92
96
 
93
97
  @classmethod
94
- def convert_time_type(cls, agate_table: agate.Table, col_idx: int) -> str:
98
+ def convert_time_type(cls, agate_table: "agate.Table", col_idx: int) -> str:
95
99
  return "time"
96
100
 
97
101
  @classmethod
@@ -5,7 +5,7 @@ actually executes the drop, and `get_drop_sql`, which returns the template.
5
5
  */ #}
6
6
 
7
7
  {% macro drop_materialized_view(relation) -%}
8
- {{ return(adapter.dispatch('drop_materialized_view', 'dbt')(relation)) }}
8
+ {{- adapter.dispatch('drop_materialized_view', 'dbt')(relation) -}}
9
9
  {%- endmacro %}
10
10
 
11
11
 
@@ -5,7 +5,7 @@ actually executes the drop, and `get_drop_sql`, which returns the template.
5
5
  */ #}
6
6
 
7
7
  {% macro drop_table(relation) -%}
8
- {{ return(adapter.dispatch('drop_table', 'dbt')(relation)) }}
8
+ {{- adapter.dispatch('drop_table', 'dbt')(relation) -}}
9
9
  {%- endmacro %}
10
10
 
11
11
 
@@ -5,7 +5,7 @@ actually executes the drop, and `get_drop_sql`, which returns the template.
5
5
  */ #}
6
6
 
7
7
  {% macro drop_view(relation) -%}
8
- {{ return(adapter.dispatch('drop_view', 'dbt')(relation)) }}
8
+ {{- adapter.dispatch('drop_view', 'dbt')(relation) -}}
9
9
  {%- endmacro %}
10
10
 
11
11
 
@@ -142,6 +142,7 @@ files = [
142
142
  ]
143
143
  exclude = [
144
144
  "dbt/adapters/events/adapter_types_pb2.py",
145
+ "dbt-tests-adapter/dbt/__init__.py", # overlaps with `dbt/__init__.py` as expected for namespaces
145
146
  "venv",
146
147
  ]
147
148
  [[tool.mypy.overrides]]
@@ -1 +0,0 @@
1
- version = "1.0.0b1"
File without changes
File without changes