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 ] ++ mashumaro.optional-dependencies.msgpack;
100
101 # tests exist for the dbt tool but not for this package specifically
102 doCheck = false;
103
104 passthru = {
105 withAdapters = callPackage ./with-adapters.nix { };
106 };
107
108 meta = {
109 description = "Enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications";
110 longDescription = ''
111 The dbt tool needs adapters to data sources in order to work. The available
112 adapters are:
113
114 dbt-bigquery
115 dbt-postgres
116 dbt-redshift
117 dbt-snowflake
118
119 An example of building this package with a few adapters:
120
121 dbt.withAdapters (adapters: [
122 adapters.dbt-bigquery
123 adapters.dbt-postgres
124 ])
125 '';
126 homepage = "https://github.com/dbt-labs/dbt-core";
127 changelog = "https://github.com/dbt-labs/dbt-core/blob/${src.tag}/CHANGELOG.md";
128 license = lib.licenses.asl20;
129 maintainers = with lib.maintainers; [
130 mausch
131 tjni
132 ];
133 mainProgram = "dbt";
134 };
135}