Class: Blazer::Adapters::PrestoAdapter
Instance Attribute Summary
Attributes inherited from BaseAdapter
#data_source
Instance Method Summary
collapse
Methods inherited from BaseAdapter
#cachable?, #cancel, #cohort_analysis_statement, #cost, #explain, #initialize, #reconnect, #schema, #supports_cohort_analysis?
Instance Method Details
#preview_statement ⇒ Object
24
25
26
|
# File 'lib/blazer/adapters/presto_adapter.rb', line 24
def preview_statement
"SELECT * FROM {table} LIMIT 10"
end
|
#run_statement(statement, comment) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/blazer/adapters/presto_adapter.rb', line 4
def run_statement(statement, )
columns = []
rows = []
error = nil
begin
columns, rows = client.run("#{statement} /*#{}*/")
columns = columns.map(&:name)
rescue => e
error = e.message
end
[columns, rows, error]
end
|
#tables ⇒ Object
19
20
21
22
|
# File 'lib/blazer/adapters/presto_adapter.rb', line 19
def tables
_, rows = client.run("SHOW TABLES")
rows.map(&:first)
end
|