1
votes

Using the Ruby gem (https://rubygems.org/gems/bigquery) I can get a list of all tables in a given bigquery dataset like so:

(Hash) tables(dataset = @dataset)

the gem doesn't seem to have support for listing all datasets in a given project in a similar fashion, but it's a feature on the API explorer though.

Is it possible to return a list of all datasets in Ruby?

1

1 Answers

2
votes

It is possible, but you'd likely need to extend the ruby gem you're using to add a dataset list method. You could likely just copy the tables list method here and change the :api_method => @bq.tables.list line to :api_method => @bq.datasets.list.

Note that the code in this gem doesn't appear to do paging, which means that you will only get the first 1000 tables in a dataset (or 1000 datasets in your project). For most people, this is fine, but can be surprising when people go over that limit.