Method: ClickHouse::Extend::ConnectionSelective#select_value
- Defined in:
- lib/click_house/extend/connection_selective.rb
#select_value(sql) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/click_house/extend/connection_selective.rb', line 12 def select_value(sql) response = get(body: sql, query: { default_format: 'JSON' }) got = Response::Factory.response(response, config).first case got when Hash Array(got).dig(0, -1) # get a value of a first key for JSON format when Array got[0] # for CSV format else got # for RowBinary format end end |