about summary refs log tree commit diff
path: root/pkgs/development/python-modules/dbt-core
diff options
context:
space:
mode:
authorTheodore Ni <3806110+tjni@users.noreply.github.com>2023-07-13 23:40:30 -0700
committerTheodore Ni <3806110+tjni@users.noreply.github.com>2023-07-23 11:03:48 -0700
commit4bfbc45869b358a32cbd5b47c26326a08f9e34a7 (patch)
tree3dc25802ca24bd8c5e3dceeb2f7abb0bb28bc127 /pkgs/development/python-modules/dbt-core
parent859e95e2bdd9889fd534d8edf64be99313a2361e (diff)
dbt: init at 1.5.3
Add a top-level dbt application with a passthru function that should be
used to extend it with adapters.
Diffstat (limited to 'pkgs/development/python-modules/dbt-core')
-rw-r--r--pkgs/development/python-modules/dbt-core/default.nix22
-rw-r--r--pkgs/development/python-modules/dbt-core/with-adapters.nix18
2 files changed, 40 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/dbt-core/default.nix b/pkgs/development/python-modules/dbt-core/default.nix
index f522cb1d239d8..bd346c3262d78 100644
--- a/pkgs/development/python-modules/dbt-core/default.nix
+++ b/pkgs/development/python-modules/dbt-core/default.nix
@@ -1,4 +1,5 @@
 { lib
+, python3
 , buildPythonPackage
 , fetchFromGitHub
 , agate
@@ -81,11 +82,32 @@ buildPythonPackage rec {
   # tests exist for the dbt tool but not for this package specifically
   doCheck = false;
 
+  passthru = {
+    withAdapters = python3.pkgs.callPackage ./with-adapters.nix { };
+  };
+
   meta = with lib; {
     description = "Enables data analysts and engineers to transform their data using the same practices that software engineers use to build applications";
+    longDescription = ''
+      The dbt tool needs adapters to data sources in order to work. The available
+      adapters are:
+
+        dbt-bigquery
+        dbt-postgres
+        dbt-redshift
+        dbt-snowflake
+
+      An example of building this package with a few adapters:
+
+        dbt.withAdapters (adapters: [
+          adapters.dbt-bigquery
+          adapters.dbt-postgres
+        ])
+    '';
     homepage = "https://github.com/dbt-labs/dbt-core";
     changelog = "https://github.com/dbt-labs/dbt-core/blob/v${version}/CHANGELOG.md";
     license = licenses.asl20;
     maintainers = with maintainers; [ mausch tjni ];
+    mainProgram = "dbt";
   };
 }
diff --git a/pkgs/development/python-modules/dbt-core/with-adapters.nix b/pkgs/development/python-modules/dbt-core/with-adapters.nix
new file mode 100644
index 0000000000000..006f4a96b853b
--- /dev/null
+++ b/pkgs/development/python-modules/dbt-core/with-adapters.nix
@@ -0,0 +1,18 @@
+{ python3
+, dbt-bigquery
+, dbt-core
+, dbt-postgres
+, dbt-redshift
+, dbt-snowflake
+}:
+let
+  adapters = {
+    inherit dbt-bigquery dbt-postgres dbt-redshift dbt-snowflake;
+  };
+in
+adapterFun: (python3.buildEnv.override {
+  extraLibs = [ dbt-core ] ++ (adapterFun adapters);
+  ignoreCollisions = true;
+}).overrideAttrs {
+  meta.mainProgram = dbt-core.meta.mainProgram;
+}