From 11a11704bc2344ff1dd7b1098b7282377d7ff144 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20K=2E=20F=C3=B8llesdal?= Date: Wed, 7 Sep 2022 15:30:40 +0200 Subject: [PATCH] databricks-sql-cli: init at 0.1.4 --- .../misc/databricks-sql-cli/default.nix | 64 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 66 insertions(+) create mode 100644 pkgs/applications/misc/databricks-sql-cli/default.nix diff --git a/pkgs/applications/misc/databricks-sql-cli/default.nix b/pkgs/applications/misc/databricks-sql-cli/default.nix new file mode 100644 index 000000000000..61191374b6ea --- /dev/null +++ b/pkgs/applications/misc/databricks-sql-cli/default.nix @@ -0,0 +1,64 @@ +{ lib +, buildPythonApplication +, fetchFromGitHub +, fetchpatch +, poetry-core +, pandas +, prompt-toolkit +, databricks-sql-connector +, pygments +, configobj +, sqlparse +, cli-helpers +, click +, pytestCheckHook +}: + +buildPythonApplication rec { + pname = "databricks-sql-cli"; + version = "0.1.4"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "databricks"; + repo = "databricks-sql-cli"; + rev = "v${version}"; + sha256 = "sha256-gr7LJfnvIu2Jf1XgILqfZoi8CbXeQyq0g1wLEBa5TPM="; + }; + + patches = [ + # https://github.com/databricks/databricks-sql-cli/pull/38 + (fetchpatch { + url = "https://github.com/databricks/databricks-sql-cli/commit/fc294e00819b6966f1605e5c1ce654473510aefe.patch"; + sha256 = "sha256-QVrb7mD0fVbHrbrDywI6tsFNYM19x74LY8rhqqC8szE="; + }) + ]; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace 'python = ">=3.7.1,<4.0"' 'python = ">=3.8,<4.0"' \ + --replace 'pandas = "1.3.4"' 'pandas = "~1.4"' + ''; + + nativeBuildInputs = [ poetry-core ]; + + propagatedBuildInputs = [ + prompt-toolkit + pandas + databricks-sql-connector + pygments + configobj + sqlparse + cli-helpers + click + ]; + + checkInputs = [ pytestCheckHook ]; + + meta = with lib; { + description = "CLI for querying Databricks SQL"; + homepage = "https://github.com/databricks/databricks-sql-cli"; + license = licenses.databricks; + maintainers = with maintainers; [ kfollesdal ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ff3535c7c78d..dbd3e959f836 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -430,6 +430,8 @@ with pkgs; cryptowatch-desktop = callPackage ../applications/finance/cryptowatch { }; + databricks-sql-cli = python3Packages.callPackage ../applications/misc/databricks-sql-cli { }; + datalad = callPackage ../applications/version-management/datalad { python3 = python39; # `boto` currently broken with Python3.10 };