Skip to content

Commit

Permalink
Merge pull request #189855 from harvidsen/python-databricks-sql-conne…
Browse files Browse the repository at this point in the history
…ctor-init
  • Loading branch information
SuperSandro2000 authored Sep 27, 2022
2 parents f5f544d + 11a1170 commit 7ad22ae
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 0 deletions.
6 changes: 6 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5235,6 +5235,12 @@
fingerprint = "3F35 E4CA CBF4 2DE1 2E90 53E5 03A6 E6F7 8693 6619";
}];
};
harvidsen = {
email = "harvidsen@gmail.com";
github = "harvidsen";
githubId = 62279738;
name = "Håkon Arvidsen";
};
haslersn = {
email = "haslersn@fius.informatik.uni-stuttgart.de";
github = "haslersn";
Expand Down
64 changes: 64 additions & 0 deletions pkgs/applications/misc/databricks-sql-cli/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, thrift
, pandas
, pyarrow
, poetry-core
, pytestCheckHook
}:

buildPythonPackage rec {
pname = "databricks-sql-connector";
version = "2.0.5";
format = "pyproject";

src = fetchFromGitHub {
owner = "databricks";
repo = "databricks-sql-python";
rev = "v${version}";
sha256 = "sha256-Qpdyn6z1mbO4bzyUZ2eYdd9pfIkIP/Aj4YgNXaYwxpE=";
};

postPatch = ''
substituteInPlace pyproject.toml \
--replace 'thrift = "^0.13.0"' 'thrift = ">=0.13.0,<1.0.0"'
'';

nativeBuildInputs = [
poetry-core
];

propagatedBuildInputs = [
thrift
pandas
pyarrow
];

checkInputs = [
pytestCheckHook
];

pytestFlagsArray = [ "tests/unit" ];

meta = with lib; {
description = "Databricks SQL Connector for Python";
homepage = https://docs.databricks.com/dev-tools/python-sql-connector.html;
license = licenses.asl20;
maintainers = with maintainers; [ harvidsen ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,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
};
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2260,6 +2260,8 @@ in {

databricks-connect = callPackage ../development/python-modules/databricks-connect { };

databricks-sql-connector = callPackage ../development/python-modules/databricks-sql-connector { };

dataclasses = callPackage ../development/python-modules/dataclasses { };

dataclasses-json = callPackage ../development/python-modules/dataclasses-json { };
Expand Down

0 comments on commit 7ad22ae

Please sign in to comment.