Class: Blazer::Adapters::BaseAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/blazer/adapters/base_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_source) ⇒ BaseAdapter

Returns a new instance of BaseAdapter.



6
7
8
# File 'lib/blazer/adapters/base_adapter.rb', line 6

def initialize(data_source)
  @data_source = data_source
end

Instance Attribute Details

#data_sourceObject (readonly)

Returns the value of attribute data_source.



4
5
6
# File 'lib/blazer/adapters/base_adapter.rb', line 4

def data_source
  @data_source
end

Instance Method Details

#cachable?(statement) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/blazer/adapters/base_adapter.rb', line 57

def cachable?(statement)
  true # optional
end

#cancel(run_id) ⇒ Object



53
54
55
# File 'lib/blazer/adapters/base_adapter.rb', line 53

def cancel(run_id)
  # optional
end

#cohort_analysis_statement(statement, period:, days:) ⇒ Object



65
66
67
# File 'lib/blazer/adapters/base_adapter.rb', line 65

def cohort_analysis_statement(statement, period:, days:)
  # optional
end

#cost(statement) ⇒ Object



45
46
47
# File 'lib/blazer/adapters/base_adapter.rb', line 45

def cost(statement)
  # optional
end

#explain(statement) ⇒ Object



49
50
51
# File 'lib/blazer/adapters/base_adapter.rb', line 49

def explain(statement)
  # optional
end

#parameter_bindingObject



21
22
23
24
25
26
27
# File 'lib/blazer/adapters/base_adapter.rb', line 21

def parameter_binding
  # optional, but recommended when possible for security
  # if specified, quoting is only used for display
  # :positional - ?
  # :numeric - $1
  # ->(statement, values) { ... } - custom method
end

#preview_statementObject



37
38
39
# File 'lib/blazer/adapters/base_adapter.rb', line 37

def preview_statement
  "" # also optional, but nice to have
end

#quotingObject



14
15
16
17
18
19
# File 'lib/blazer/adapters/base_adapter.rb', line 14

def quoting
  # required, how to quote variables
  # :backslash_escape - single quote strings and convert ' to \' and \ to \\
  # :single_quote_escape - single quote strings and convert ' to ''
  # ->(value) { ... } - custom method
end

#reconnectObject



41
42
43
# File 'lib/blazer/adapters/base_adapter.rb', line 41

def reconnect
  # optional
end

#run_statement(statement, comment) ⇒ Object



10
11
12
# File 'lib/blazer/adapters/base_adapter.rb', line 10

def run_statement(statement, comment)
  # required
end

#schemaObject



33
34
35
# File 'lib/blazer/adapters/base_adapter.rb', line 33

def schema
  [] # optional, but nice to have
end

#supports_cohort_analysis?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/blazer/adapters/base_adapter.rb', line 61

def supports_cohort_analysis?
  false # optional
end

#tablesObject



29
30
31
# File 'lib/blazer/adapters/base_adapter.rb', line 29

def tables
  [] # optional, but nice to have
end