lib/google/cloud/bigquery/service.rb in google-cloud-bigquery-1.2.0 vs lib/google/cloud/bigquery/service.rb in google-cloud-bigquery-1.3.0
- old
+ new
@@ -68,10 +68,14 @@
service
end
end
attr_accessor :mocked_service
+ def project_service_account
+ service.get_project_service_account project
+ end
+
##
# Lists all datasets in the specified project to which you have
# been granted the READER dataset role.
def list_datasets options = {}
# The list operation is considered idempotent
@@ -200,18 +204,20 @@
end
end
def insert_tabledata dataset_id, table_id, rows, options = {}
json_rows = Array(rows).map { |row| Convert.to_json_row row }
-
insert_tabledata_json_rows dataset_id, table_id, json_rows, options
end
def insert_tabledata_json_rows dataset_id, table_id, json_rows,
options = {}
- insert_rows = Array(json_rows).map do |json_row|
+
+ rows_and_ids = Array(json_rows).zip Array(options[:insert_ids])
+ insert_rows = rows_and_ids.map do |json_row, insert_id|
+ insert_id ||= SecureRandom.uuid
{
- insertId: SecureRandom.uuid,
+ insertId: insert_id,
json: json_row
}
end
insert_req = {