dbt-postgres 1.8.0b1__tar.gz → 1.8.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.
Files changed (47) hide show
  1. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/PKG-INFO +8 -6
  2. dbt_postgres-1.8.0b2/dbt/adapters/postgres/__version__.py +1 -0
  3. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/adapters/postgres/relation.py +5 -5
  4. dbt_postgres-1.8.0b2/hatch_build.py +56 -0
  5. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/pyproject.toml +9 -10
  6. dbt_postgres-1.8.0b1/dbt/adapters/postgres/__version__.py +0 -1
  7. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/.gitignore +0 -0
  8. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/LICENSE +0 -0
  9. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/README.md +0 -0
  10. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/__init__.py +0 -0
  11. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/adapters/postgres/__init__.py +0 -0
  12. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/adapters/postgres/column.py +0 -0
  13. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/adapters/postgres/connections.py +0 -0
  14. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/adapters/postgres/impl.py +0 -0
  15. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/adapters/postgres/relation_configs/__init__.py +0 -0
  16. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/adapters/postgres/relation_configs/constants.py +0 -0
  17. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/adapters/postgres/relation_configs/index.py +0 -0
  18. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/adapters/postgres/relation_configs/materialized_view.py +0 -0
  19. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/__init__.py +0 -0
  20. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/dbt_project.yml +0 -0
  21. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/adapters.sql +0 -0
  22. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/catalog.sql +0 -0
  23. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/materializations/incremental_strategies.sql +0 -0
  24. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/materializations/snapshot_merge.sql +0 -0
  25. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/materialized_view/alter.sql +0 -0
  26. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/materialized_view/create.sql +0 -0
  27. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/materialized_view/describe.sql +0 -0
  28. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/materialized_view/drop.sql +0 -0
  29. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/materialized_view/refresh.sql +0 -0
  30. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/materialized_view/rename.sql +0 -0
  31. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/table/drop.sql +0 -0
  32. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/table/rename.sql +0 -0
  33. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/table/replace.sql +0 -0
  34. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/view/drop.sql +0 -0
  35. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/view/rename.sql +0 -0
  36. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations/view/replace.sql +0 -0
  37. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/relations.sql +0 -0
  38. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/timestamps.sql +0 -0
  39. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/utils/any_value.sql +0 -0
  40. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/utils/columns_spec_ddl.sql +0 -0
  41. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/utils/dateadd.sql +0 -0
  42. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/utils/datediff.sql +0 -0
  43. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/utils/last_day.sql +0 -0
  44. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/utils/listagg.sql +0 -0
  45. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/macros/utils/split_part.sql +0 -0
  46. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/profile_template.yml +0 -0
  47. {dbt_postgres-1.8.0b1 → dbt_postgres-1.8.0b2}/dbt/include/postgres/sample_profiles.yml +0 -0
@@ -1,6 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: dbt-postgres
3
- Version: 1.8.0b1
3
+ Version: 1.8.0b2
4
+ Dynamic: Requires-Dist
4
5
  Summary: The set of adapter protocols and base functionality that supports integration with dbt-core
5
6
  Project-URL: Homepage, https://github.com/dbt-labs/dbt-postgres
6
7
  Project-URL: Documentation, https://docs.getdbt.com
@@ -21,10 +22,11 @@ Classifier: Programming Language :: Python :: 3.9
21
22
  Classifier: Programming Language :: Python :: 3.10
22
23
  Classifier: Programming Language :: Python :: 3.11
23
24
  Requires-Python: >=3.8.0
24
- Requires-Dist: agate<2.0,>=1.0
25
- Requires-Dist: dbt-adapters<2.0,>=0.1.0a1
26
- Requires-Dist: dbt-common<2.0,>=0.1.0a1
27
- Requires-Dist: psycopg2<3.0,>=2.9
25
+ Requires-Dist: dbt-adapters>=0.1.0a1,<2.0
26
+ Requires-Dist: dbt-core>=1.8.0a1
27
+ Requires-Dist: dbt-common>=0.1.0a1,<2.0
28
+ Requires-Dist: agate>=1.0,<2.0
29
+ Requires-Dist: psycopg2-binary>=2.9,<3.0
28
30
  Description-Content-Type: text/markdown
29
31
 
30
32
  <p align="center">
@@ -0,0 +1 @@
1
+ version = "1.8.0b2"
@@ -1,4 +1,4 @@
1
- from dataclasses import dataclass
1
+ from dataclasses import dataclass, field
2
2
  from typing import FrozenSet, Optional, Set
3
3
 
4
4
  from dbt.adapters.base.relation import BaseRelation
@@ -20,19 +20,19 @@ from dbt.adapters.postgres.relation_configs import (
20
20
 
21
21
  @dataclass(frozen=True, eq=False, repr=False)
22
22
  class PostgresRelation(BaseRelation):
23
- renameable_relations = frozenset(
23
+ renameable_relations: FrozenSet[RelationType] = field(default_factory=lambda: frozenset(
24
24
  {
25
25
  RelationType.View,
26
26
  RelationType.Table,
27
27
  RelationType.MaterializedView,
28
28
  }
29
- )
30
- replaceable_relations = frozenset(
29
+ ))
30
+ replaceable_relations: FrozenSet[RelationType] = field(default_factory=lambda: frozenset(
31
31
  {
32
32
  RelationType.View,
33
33
  RelationType.Table,
34
34
  }
35
- )
35
+ ))
36
36
 
37
37
  def __post_init__(self):
38
38
  # Check for length of Postgres table/view names.
@@ -0,0 +1,56 @@
1
+ import os
2
+ from typing import Any, Dict
3
+
4
+ from hatchling.builders.config import BuilderConfig
5
+ from hatchling.builders.hooks.plugin.interface import BuildHookInterface
6
+ from hatchling.plugin import hookimpl
7
+
8
+ BASE_DEPS = [
9
+ # psycopg2 dependency installed in custom hatch_build.py
10
+ "dbt-adapters>=0.1.0a1,<2.0",
11
+ # add dbt-core to ensure backwards compatibility of installation, this is not a functional dependency
12
+ "dbt-core>=1.8.0a1",
13
+ # installed via dbt-adapters but used directly
14
+ "dbt-common>=0.1.0a1,<2.0",
15
+ "agate>=1.0,<2.0",
16
+ ]
17
+
18
+ PSYCOPG2_MESSAGE = """
19
+ No package name override was set.
20
+ Using 'psycopg2-binary' package to satisfy 'psycopg2'
21
+
22
+ If you experience segmentation faults, silent crashes, or installation errors,
23
+ consider retrying with the 'DBT_PSYCOPG2_NAME' environment variable set to
24
+ 'psycopg2'. It may require a compiler toolchain and development libraries!
25
+ """.strip()
26
+
27
+
28
+ def _dbt_psycopg2_name():
29
+ # if the user chose something, use that
30
+ package_name = os.getenv("DBT_PSYCOPG2_NAME", "")
31
+ if package_name:
32
+ return package_name
33
+
34
+ # default to psycopg2-binary for all OSes/versions
35
+ print(PSYCOPG2_MESSAGE)
36
+ return "psycopg2-binary"
37
+
38
+
39
+ class CustomBuildHook(BuildHookInterface[BuilderConfig]):
40
+ """
41
+ Custom build hook to install psycopg2 instead of psycopg2-binary based on the presence of `DBT_PSYCOPG2_NAME` env
42
+ var. This is necessary as psycopg2-binary is better for local development, but psycopg2 is better for production.
43
+ """
44
+
45
+ def __init__(self, *args: Any, **kwargs: Any) -> None:
46
+ super().__init__(*args, **kwargs)
47
+
48
+ def initialize(self, version: str, build_data: Dict) -> None:
49
+ build_data["dependencies"] = BASE_DEPS
50
+ psycopg2_pkg_name = _dbt_psycopg2_name()
51
+ build_data["dependencies"].append(f"{psycopg2_pkg_name}>=2.9,<3.0")
52
+
53
+
54
+ @hookimpl
55
+ def hatch_register_build_hook():
56
+ return CustomBuildHook
@@ -1,5 +1,5 @@
1
1
  [project]
2
- dynamic = ["version"]
2
+ dynamic = ["version", "dependencies"]
3
3
  name = "dbt-postgres"
4
4
  description = "The set of adapter protocols and base functionality that supports integration with dbt-core"
5
5
  readme = "README.md"
@@ -22,13 +22,7 @@ classifiers = [
22
22
  "Programming Language :: Python :: 3.10",
23
23
  "Programming Language :: Python :: 3.11",
24
24
  ]
25
- dependencies = [
26
- "dbt-adapters>=0.1.0a1,<2.0",
27
- "psycopg2>=2.9,<3.0",
28
- # installed via dbt-adapters but used directly
29
- "dbt-common>=0.1.0a1,<2.0",
30
- "agate>=1.0,<2.0",
31
- ]
25
+
32
26
  [project.urls]
33
27
  Homepage = "https://github.com/dbt-labs/dbt-postgres"
34
28
  Documentation = "https://docs.getdbt.com"
@@ -49,6 +43,9 @@ packages = ["dbt"]
49
43
  [tool.hatch.version]
50
44
  path = "dbt/adapters/postgres/__version__.py"
51
45
 
46
+ [tool.hatch.build.hooks.custom]
47
+ path = "./hatch_build.py"
48
+
52
49
  [tool.hatch.envs.default]
53
50
  dependencies = [
54
51
  "dbt-adapters @ git+https://github.com/dbt-labs/dbt-adapters.git",
@@ -58,7 +55,7 @@ dependencies = [
58
55
  [tool.hatch.envs.lint]
59
56
  detached = true
60
57
  dependencies = [
61
- "black",
58
+ "black>=24.3",
62
59
  "flake8",
63
60
  "Flake8-pyproject",
64
61
  ]
@@ -119,6 +116,8 @@ dependencies = [
119
116
  "twine",
120
117
  "check-wheel-contents",
121
118
  ]
119
+
120
+
122
121
  [tool.hatch.envs.build.scripts]
123
122
  check-all = [
124
123
  "- check-wheel",
@@ -166,4 +165,4 @@ env_files = ["test.env"]
166
165
  testpaths = [
167
166
  "tests/functional",
168
167
  "tests/unit",
169
- ]
168
+ ]
@@ -1 +0,0 @@
1
- version = "1.8.0b1"
File without changes
File without changes