From 4bfbc45869b358a32cbd5b47c26326a08f9e34a7 Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Thu, 13 Jul 2023 23:40:30 -0700 Subject: 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. --- .../python-modules/dbt-core/default.nix | 22 ++++++++++++++++++++++ .../python-modules/dbt-core/with-adapters.nix | 18 ++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 pkgs/development/python-modules/dbt-core/with-adapters.nix (limited to 'pkgs/development/python-modules/dbt-core') 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; +} -- cgit 1.4.1