Module: UmbrellioUtils::ClickHouse

Extended by:
ClickHouse
Included in:
ClickHouse
Defined in:
lib/umbrellio_utils/click_house.rb,
lib/umbrellio_utils/click_house/backends.rb,
lib/umbrellio_utils/click_house/backends/base.rb,
lib/umbrellio_utils/click_house/backends/legacy.rb,
lib/umbrellio_utils/click_house/backends/native.rb

Overview

Polymorphic ClickHouse facade. The active backend is picked up from ‘UmbrellioUtils.config.clickhouse_backend` — `:legacy` routes through the `click_house` gem (HTTP), `:native` through the `clickhouse-native` gem (TCP). Both backends expose the same public surface so consumer code (including UmbrellioUtils::Migrations) is backend-agnostic.

Defined Under Namespace

Modules: Backends

Constant Summary collapse

VALID_BACKENDS =
%i[legacy native].freeze
DELEGATED =
%i[
  execute query query_value query_each count insert
  from describe_table server_version tables
  create_database drop_database db_name config
  truncate_table! drop_table! optimize_table! on_cluster
  parse_value pg_table_connection populate_temp_table! with_temp_table
].freeze

Instance Method Summary collapse

Instance Method Details

#backendObject



30
31
32
# File 'lib/umbrellio_utils/click_house.rb', line 30

def backend
  @backend ||= backend_for(UmbrellioUtils.config.clickhouse_backend)
end

#reset_backend!Object

Testing hook — clears the memoized backend so specs can flip ‘clickhouse_backend` mid-run. Not part of the public API.



36
37
38
# File 'lib/umbrellio_utils/click_house.rb', line 36

def reset_backend!
  @backend = nil
end