From dcddc57e1545f8db3bf40eb107b5df7a1a9d6d0d Mon Sep 17 00:00:00 2001 From: C4 Patino Date: Wed, 3 Jun 2026 18:55:14 -0500 Subject: [PATCH 1/2] python3Packages.harlequin-odbc: init at 0.4.0 --- .../python-modules/harlequin-odbc/default.nix | 52 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 54 insertions(+) create mode 100644 pkgs/development/python-modules/harlequin-odbc/default.nix diff --git a/pkgs/development/python-modules/harlequin-odbc/default.nix b/pkgs/development/python-modules/harlequin-odbc/default.nix new file mode 100644 index 000000000000..dbaa4a720fc1 --- /dev/null +++ b/pkgs/development/python-modules/harlequin-odbc/default.nix @@ -0,0 +1,52 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + pythonAtLeast, + hatchling, + duckdb, + pyodbc, +}: +buildPythonPackage (finalAttrs: { + pname = "harlequin-odbc"; + version = "0.4.0"; + pyproject = true; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "tconbeer"; + repo = "harlequin-odbc"; + tag = "v${finalAttrs.version}"; + hash = "sha256-U0z7fgBzdL+PRhll6AH4DziqY26kVYA4qkOEbZbWF1g="; + }; + + build-system = [ + hatchling + ]; + + # harlequin loads this adapter as a plugin, so depending on harlequin would + # create a cycle, as harlequin can depend on this package. + pythonRemoveDeps = [ + "harlequin" + ]; + + dependencies = [ + pyodbc + ] + ++ lib.optionals (pythonAtLeast "3.14") [ + duckdb + ]; + + # The test suite needs harlequin (removed above) and a live database + # reachable over ODBC. + doCheck = false; + + meta = { + description = "A Harlequin adapter for ODBC drivers"; + homepage = "https://github.com/tconbeer/harlequin-odbc"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + c4patino + ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 97713f685b95..d1433ad95217 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7545,6 +7545,8 @@ self: super: with self; { harlequin-bigquery = callPackage ../development/python-modules/harlequin-bigquery { }; + harlequin-odbc = callPackage ../development/python-modules/harlequin-odbc { }; + harlequin-postgres = callPackage ../development/python-modules/harlequin-postgres { }; hass-client = callPackage ../development/python-modules/hass-client { }; From 70a303c35dcd77d9294b0e539dda624a197ce994 Mon Sep 17 00:00:00 2001 From: C4 Patino Date: Wed, 14 Oct 2026 11:23:51 -0500 Subject: [PATCH 2/2] harlequin: add withOdbcAdapter flag, skip spec options test --- pkgs/by-name/ha/harlequin/package.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/ha/harlequin/package.nix b/pkgs/by-name/ha/harlequin/package.nix index 406aec8e7876..acfedcc450a5 100644 --- a/pkgs/by-name/ha/harlequin/package.nix +++ b/pkgs/by-name/ha/harlequin/package.nix @@ -9,8 +9,8 @@ writableTmpDirAsHomeHook, withPostgresAdapter ? true, withBigQueryAdapter ? true, + withOdbcAdapter ? true, }: - python3Packages.buildPythonApplication (finalAttrs: { pname = "harlequin"; version = "2.16.1"; @@ -61,7 +61,8 @@ python3Packages.buildPythonApplication (finalAttrs: { wcwidth ] ++ lib.optionals withPostgresAdapter [ harlequin-postgres ] - ++ lib.optionals withBigQueryAdapter [ harlequin-bigquery ]; + ++ lib.optionals withBigQueryAdapter [ harlequin-bigquery ] + ++ lib.optionals withOdbcAdapter [ harlequin-odbc ]; pythonImportsCheck = [ "harlequin" @@ -112,6 +113,12 @@ python3Packages.buildPythonApplication (finalAttrs: { ++ lib.optionals (!stdenv.hostPlatform.isx86_64) [ # Test incorrectly tries to load a dylib/so compiled for x86_64 "test_load_extension" + ] + ++ lib.optionals withOdbcAdapter [ + # harlequin-odbc declares no adapter options (its connection string is a + # positional argument), and this test requires every installed adapter to + # declare at least one. + "test_spec_covers_every_installed_adapter" ]; disabledTestPaths = [