GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: Add possibility to overwrite send_receive_timeout for clickhouse offline store by astronautas · Pull Request #5792 · feast-dev/feast

fix: Add possibility to overwrite send_receive_timeout for clickhouse offline store #5792

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
ntkathole merged 4 commits into feast-dev:master from astronautas:fix/control-clickhouse-offline-store-client-timeouts
Dec 23, 2025

Uh oh!

There was an error while loading. Please reload this page.

Merged

fix: Add possibility to overwrite send_receive_timeout for clickhouse offline store #5792

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
4 commits
Select commit Hold shift + click to select a range
2f5a1c1
add changes + fix linting issues
astronautas Dec 22, 2025
24f6f40
generalize based on pr suggestion
astronautas Dec 22, 2025
a05c6ab
add test verifying config parsing
astronautas Dec 22, 2025
a3b9977
rework test into integration, since CH instance is needed
astronautas Dec 22, 2025
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

28 changes: 28 additions & 0 deletions 28 sdk/python/feast/infra/offline_stores/contrib/clickhouse_offline_store/tests/data_source.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from feast.infra.offline_stores.contrib.clickhouse_offline_store.clickhouse_source import (
ClickhouseSource,
)
from feast.infra.utils.clickhouse.clickhouse_config import ClickhouseConfig
from feast.infra.utils.clickhouse.connection_utils import get_client
from tests.integration.feature_repos.universal.data_source_creator import (
DataSourceCreator,
)
Expand Down Expand Up @@ -114,3 +116,29 @@ def create_saved_dataset_destination(self):

def teardown(self):
pass


def test_get_client_with_additional_params(clickhouse_container):
"""
Test that get_client works with a real ClickHouse container and properly passes
additional settings like send_receive_timeout.
"""
# Create config with custom send_receive_timeout
config = ClickhouseConfig(
host=clickhouse_container.get_container_host_ip(),
port=clickhouse_container.get_exposed_port(8123),
user=CLICKHOUSE_USER,
password=CLICKHOUSE_PASSWORD,
database=CLICKHOUSE_OFFLINE_DB,
additional_client_args={"send_receive_timeout": 60},
)

# Get client and verify it works
client = get_client(config)

# Verify client is connected and functional by running a simple query
result = client.query("SELECT 1 AS test_value")
assert result.result_rows == [(1,)]

# Verify the send_receive_timeout was applied
assert client.timeout._read == 60
6 changes: 6 additions & 0 deletions 6 sdk/python/feast/infra/utils/clickhouse/clickhouse_config.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Any

from pydantic import ConfigDict, StrictStr

from feast.repo_config import FeastConfigBaseModel
Expand All @@ -11,4 +13,8 @@ class ClickhouseConfig(FeastConfigBaseModel):
password: StrictStr
use_temporary_tables_for_entity_df: bool = True

# See https://github.com/ClickHouse/clickhouse-connect/blob/main/clickhouse_connect/driver/__init__.py#L51
# Some typical ones e.g. send_receive_timeout (read_timeout), etc
additional_client_args: dict[str, Any] | None = None

model_config = ConfigDict(frozen=True)
26 changes: 19 additions & 7 deletions 26 sdk/python/feast/infra/utils/clickhouse/connection_utils.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,24 @@
def get_client(config: ClickhouseConfig) -> Client:
# Clickhouse client is not thread-safe, so we need to create a separate instance for each thread.
if not hasattr(thread_local, "clickhouse_client"):
thread_local.clickhouse_client = clickhouse_connect.get_client(
host=config.host,
port=config.port,
user=config.user,
password=config.password,
database=config.database,
)
additional_client_args = config.additional_client_args

if additional_client_args:
thread_local.clickhouse_client = clickhouse_connect.get_client(
host=config.host,
port=config.port,
user=config.user,
password=config.password,
database=config.database,
**additional_client_args,
)
else:
thread_local.clickhouse_client = clickhouse_connect.get_client(
host=config.host,
port=config.port,
user=config.user,
password=config.password,
database=config.database,
)

return thread_local.clickhouse_client
57 changes: 57 additions & 0 deletions 57 sdk/python/tests/unit/infra/offline_stores/test_clickhouse.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import threading
from unittest.mock import MagicMock, patch

Expand All @@ -6,6 +7,8 @@
from feast.infra.utils.clickhouse.clickhouse_config import ClickhouseConfig
from feast.infra.utils.clickhouse.connection_utils import get_client, thread_local

logger = logging.getLogger(__name__)


@pytest.fixture
def clickhouse_config():
Expand Down Expand Up @@ -76,3 +79,57 @@ def thread_2_work():
assert client_1a is not client_2, (
"Different threads should get different client instances (not cached)"
)


def test_clickhouse_config_parses_additional_client_args():
"""
Test that ClickhouseConfig correctly parses additional_client_args from a dict,
simulating how it would be parsed from YAML by Pydantic.
"""
# This simulates the dict that would come from yaml.safe_load()
raw_config = {
"host": "localhost",
"port": 8123,
"database": "default",
"user": "default",
"password": "password",
"additional_client_args": {
"send_receive_timeout": 60,
"compress": True,
"client_name": "feast_test",
},
}

# Pydantic should parse this dict into a ClickhouseConfig object
config = ClickhouseConfig(**raw_config)

# Verify all fields are correctly parsed
assert config.host == "localhost"
assert config.port == 8123
assert config.database == "default"
assert config.user == "default"
assert config.password == "password"

# Verify additional_client_args is correctly parsed as a dict
assert config.additional_client_args is not None
assert isinstance(config.additional_client_args, dict)
assert config.additional_client_args["send_receive_timeout"] == 60
assert config.additional_client_args["compress"] is True
assert config.additional_client_args["client_name"] == "feast_test"


def test_clickhouse_config_handles_none_additional_client_args():
"""
Test that ClickhouseConfig correctly handles when additional_client_args is not provided.
"""
raw_config = {
"host": "localhost",
"port": 8123,
"database": "default",
"user": "default",
"password": "password",
}

config = ClickhouseConfig(**raw_config)

assert config.additional_client_args is None
Loading
Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.