# Databricks Gem ## Overview This gem is designed to allow access to the DBX APIs (Jobs and SQL) from ruby applications. ## Installation TODO: write this section ## Usage Set up your .env file (optional) ```bash # .env DBX_HOST=DBX_CONNECTION_URL DBX_TOKEN=YOUR_TOKEN_HERE DBX_WAREHOUSE_ID=WAREHOUSE_ID_HERE ``` running sql from a ruby script ```ruby require 'dbx' # If using a .env file sql_runner = DatabricksGateway.new # If not using .env file... sql_runner = DatabricksGateway.new(host: 'DBX_CONNECTION_STRING', token: 'DBX_ACCESS_TOKEN', warehouse: 'DBX_SQL_WAREHOUSE_ID') # Basic sql result = sql_runner.run_sql("SELECT 1") sql_runner.parse_result(result) # => [{"1"=>"1"}] # Dummy data in public DBX table result = sql_runner.run_sql("SELECT * FROM samples.nyctaxi.trips LIMIT 1") sql_runner.parse_result(result) # => [{"tpep_pickup_datetime"=>"2016-02-14T16:52:13.000Z", # "tpep_dropoff_datetime"=>"2016-02-14T17:16:04.000Z", # "trip_distance"=>"4.94", # "fare_amount"=>"19.0", # "pickup_zip"=>"10282", # "dropoff_zip"=>"10171"}] ```