README.md in dbx-api-0.2.0 vs README.md in dbx-api-0.2.1
- old
+ new
@@ -78,19 +78,38 @@
# do something else if the query failed
puts "query failed: #{res.error_message}"
```
+The result of `DatabrucksSQLResponse.results` is always a an array of hashes with string keys. You can map over this array using whatever ruby code you like. For example:
+```ruby
+sql_response = sql_runnner.run_sql(my_query)
+
+# count the number of results
+sql_response.results.length
+```
+
+If you would prefer a symbolized hash, you can use the `symbolize_keys` option when calling `results`:
+```ruby
+sql_response.results(symbolize_keys: true)
+```
+
Since `run_sql` returns an instance of `DatabricksSQLResponse`, you can also chain methods together:
```ruby
sql_runner.run_sql("SELECT 1").results
```
+The `run_sql` method hanldes slow queries by pinging databricks at set time intervals (default 5 seconds) until the query either fails or succeeds. The default sleep_timer can be set to any desired time interval at initialization:
+```ruby
+# changing the default sleep timer to 1 second
+sql_runner = DatabricksGateway.new(sleep_timer: 1)
+```
+
## Development
- After checking out the repo, run `bin/setup` to install dependencies.
- Set up your `.env` file as described above.
- Run `rake spec` to run the rspec tests.
## Build
- Run `gem build dbx.gemspec ` to build the gem.
- Run `gem push dbx-api-0.2.0.gem` to push the gem to rubygems.org
- - Requires logging in to rubygems.org first via `gem login`
\ No newline at end of file
+ - Requires logging in to rubygems.org first via `gem login`