Class: Dbwatcher::Services::Analyzers::TableSummaryBuilder

Inherits:
BaseService
  • Object
show all
Defined in:
lib/dbwatcher/services/analyzers/table_summary_builder.rb

Overview

Builds comprehensive table summaries from session data

This service aggregates table operations, captures sample records, and builds complete table summaries for analysis and visualization.

Examples:

builder = TableSummaryBuilder.new(session)
summary = builder.call
# => { "users" => { columns: Set, sample_record: {}, operations: {}, changes: [] } }

Instance Method Summary collapse

Methods inherited from BaseService

call

Methods included from Logging

#debug_enabled?, #log_debug, #log_error, #log_info, #log_warn

Constructor Details

#initialize(session) ⇒ TableSummaryBuilder

Initialize with session

Parameters:

  • session (Session)

    session to analyze



21
22
23
24
25
# File 'lib/dbwatcher/services/analyzers/table_summary_builder.rb', line 21

def initialize(session)
  super()
  @session = session
  @processor = SessionDataProcessor.new(session)
end

Instance Method Details

#callHash

Build table summaries from session data

Returns:

  • (Hash)

    table summaries keyed by table name



30
31
32
33
34
35
36
37
# File 'lib/dbwatcher/services/analyzers/table_summary_builder.rb', line 30

def call
  log_service_start("session_id=#{session.id} changes_count=#{session.changes.length}")

  start_time = Time.now
  tables = build_tables_data
  log_service_completion(start_time, result_context(tables))
  tables
end