1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 agate,
11 click,
12 daff,
13 dbt-adapters,
14 dbt-common,
15 dbt-extractor,
16 dbt-semantic-interfaces,
17 jinja2,
18 logbook,
19 mashumaro,
20 networkx,
21 packaging,
22 pathspec,
23 protobuf,
24 pydantic,
25 pydantic-settings,
26 pytz,
27 pyyaml,
28 requests,
29 snowplow-tracker,
30 sqlparse,
31 typing-extensions,
32
33 # passthru
34 callPackage,
35}:
36
37buildPythonPackage rec {
38 pname = "dbt-core";
39 version = "1.10.0b2";
40 pyproject = true;
41
42 src = fetchFromGitHub {
43 owner = "dbt-labs";
44 repo = "dbt-core";
45 tag = "v${version}";
46 hash = "sha256-MTrdpbPqdakFDmLKRFJ23u9hLgGhZ5T+r4om9HPBjkw=";
47 };
48
49 postPatch = ''
50 substituteInPlace dbt/utils/artifact_upload.py \
51 --replace-fail \
52 "from pydantic import BaseSettings" \
53 "from pydantic_settings import BaseSettings"
54 '';
55
56 sourceRoot = "${src.name}/core";
57
58 pythonRelaxDeps = [
59 "agate"
60 "click"
61 "dbt-common"
62 "dbt-semantic-interfaces"
63 "logbook"
64 "mashumaro"
65 "networkx"
66 "pathspec"
67 "protobuf"
68 "pydantic"
69 "urllib3"
70 ];
71
72 build-system = [
73 setuptools
74 ];
75
76 dependencies = [
77 agate
78 click
79 daff
80 dbt-adapters
81 dbt-common
82 dbt-extractor
83 dbt-semantic-interfaces
84 jinja2
85 logbook
86 mashumaro
87 networkx
88 packaging
89 pathspec
90 protobuf
91 pydantic
92 pydantic-settings
93 pytz
94 pyyaml
95 requests
96 snowplow-tracker
97 sqlparse
98 typing-extensions
99 ]
100 ++ mashumaro.optional-dependencies.msgpack;
101
102 # tests exist for the dbt tool but not for this package specifically
103 doCheck = false;
104
105 passthru = {
106 withAdapters = callPackage ./with-adapters.nix { };
107 };
108
109 meta = {
110 description = "Enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications";
111 longDescription = ''
112 The dbt tool needs adapters to data sources in order to work. The available
113 adapters are:
114
115 dbt-bigquery
116 dbt-postgres
117 dbt-redshift
118 dbt-snowflake
119
120 An example of building this package with a few adapters:
121
122 dbt.withAdapters (adapters: [
123 adapters.dbt-bigquery
124 adapters.dbt-postgres
125 ])
126 '';
127 homepage = "https://github.com/dbt-labs/dbt-core";
128 changelog = "https://github.com/dbt-labs/dbt-core/blob/${src.tag}/CHANGELOG.md";
129 license = lib.licenses.asl20;
130 maintainers = with lib.maintainers; [
131 mausch
132 tjni
133 ];
134 mainProgram = "dbt";
135 };
136}