lib/dbx/databricks/sql_response.rb in dbx-api-0.2.0 vs lib/dbx/databricks/sql_response.rb in dbx-api-0.2.1

- old
+ new

@@ -95,18 +95,19 @@ # @return [Array<Array>] def extract_data_array body.dig("result", "data_array") || body["data_array"] || [] end - # Return the results of the query as an array of hashes. + # Return the results of the query as an array of hashes with string keys. # @return [Array<Hash>] - def results + def results(symbolize_keys: false) return [] if failed? data_array.map do |row| hash = {} columns.each do |column| - hash[column["name"]] = row[column["position"]] + key = symbolize_keys ? column["name"].to_sym : column["name"] + hash[key] = row[column["position"]] end hash end end end