Module: DWH

Extended by:
Factory
Defined in:
lib/dwh.rb,
lib/dwh/table.rb,
lib/dwh/column.rb,
lib/dwh/errors.rb,
lib/dwh/logger.rb,
lib/dwh/factory.rb,
lib/dwh/version.rb,
lib/dwh/adapters.rb,
lib/dwh/settings.rb,
lib/dwh/behaviors.rb,
lib/dwh/functions.rb,
lib/dwh/table_stats.rb,
lib/dwh/token_store.rb,
lib/dwh/capabilities.rb,
lib/dwh/adapters/druid.rb,
lib/dwh/adapters/trino.rb,
lib/dwh/adapters/athena.rb,
lib/dwh/adapters/my_sql.rb,
lib/dwh/adapters/sqlite.rb,
lib/dwh/functions/dates.rb,
lib/dwh/functions/nulls.rb,
lib/dwh/streaming_stats.rb,
lib/dwh/adapters/duck_db.rb,
lib/dwh/functions/arrays.rb,
lib/dwh/adapters/postgres.rb,
lib/dwh/adapters/redshift.rb,
lib/dwh/adapters/snowflake.rb,
lib/dwh/adapters/databricks.rb,
lib/dwh/adapters/sql_server.rb,
lib/dwh/adapters/click_house.rb,
lib/dwh/adapters/token_manageable.rb,
lib/dwh/adapters/open_authorizable.rb,
lib/dwh/functions/extract_date_part.rb

Overview

DWH encapsulates the full functionality of this gem.

Examples:

Create an instance of an existing registered adapter:

DWH.create("snowflake", {warehouse: "wh", account_id: "myid"})

Check if an adapter exists:

DWH.adapter?(:redshift)

Register your own adatper:

DWH.register(:my_adapter, MyLib::MyAdapter)

Defined Under Namespace

Modules: Adapters, Behaviors, Capabilities, Factory, Functions, Logger, Settings Classes: AuthenticationError, Column, ConfigError, ConnectionError, DWHError, ExecutionError, OAuthError, StreamingStats, Table, TableStats, TokenExpiredError, TokenStore, UnsupportedCapability

Constant Summary collapse

INT_TYPES =
%w[int integer bigint tinyint smallint].freeze
DEC_TYPES =
%w[real float double decimal].freeze
STRING_TYPES =
%w[string char varchar varbinary json].freeze
TIMESTAMP_TYPES =
['timestamp with time zone', 'timestamp(p)', 'timestamp'].freeze
DATE_TYPES =
%w[date].freeze
VERSION =
'0.5.0'

Class Method Summary collapse

Methods included from Factory

adapter?, adapters, create, get_adapter, pool, pools, register, shutdown, start_reaper, unregister

Methods included from Logger

#logger, logger

Class Method Details

.aggregate_functionsObject

Baseline aggregate functions shared by all adapters (from base.yml). Per-adapter sets (adapter.aggregate_functions) extend this.



72
73
74
# File 'lib/dwh.rb', line 72

def self.aggregate_functions
  @aggregate_functions ||= Array(base_settings[:aggregate_functions]).map { |k| k.to_s.downcase }.uniq.freeze
end

.base_settingsObject

The raw base.yml settings, loaded once. This is the single source of truth for the standard, warehouse-agnostic dialect baseline.



60
61
62
# File 'lib/dwh.rb', line 60

def self.base_settings
  @base_settings ||= YAML.load_file(Settings::BASE_SETTINGS_FILE).transform_keys(&:to_sym)
end

.reserved_keywordsObject

Baseline reserved keywords shared by all adapters (from base.yml). Per-adapter sets (adapter.reserved_keywords) extend this.



66
67
68
# File 'lib/dwh.rb', line 66

def self.reserved_keywords
  @reserved_keywords ||= Array(base_settings[:reserved_keywords]).map { |k| k.to_s.downcase }.uniq.freeze
end