Setup

library(googleAuthR)
library(googleCloudAutoMLTablesR)

options(googleAuthR.scopes.selected = "https://www.googleapis.com/auth/cloud-platform")

gar_auth_service(json_file = Sys.getenv("GAR_SERVICE_JSON"))

Set global arguements

projectId <- Sys.getenv("GCAT_DEFAULT_PROJECT_ID")
location <- "us-central1"
gcat_region_set("us-central1")
## 2021-04-21 00:46:37> Region set to 'us-central1'
gcat_project_set(projectId)
## 2021-04-21 00:46:37> ProjectId set to 'gc-automl-tables-r'

Create a dataset

gcat_dataset <- gcat_create_dataset(displayName = "example_dataset01")
gcat_dataset
## ==Google Cloud AutoML Tables Dataset==
## displayName:          example_dataset01 
## createTime:           2021-04-21 00:46:39 
## statsUpdateTime:      1970-01-01

List datasets

datasets_list <- gcat_list_datasets()
datasets_list
##         displayName          createTime
## 1 example_dataset01 2021-04-21 00:46:39
## 2        test_01_bq 2019-08-24 18:30:35
## 3       test_03_gcs 2020-03-26 19:17:53
## 4       test_02_gcs 2020-03-26 19:06:14
## 5           test_01 2019-06-20 12:26:51
##                                                                   etag
## 1 AB3BwFon6jasb-sTiHyxb_l4B_91K2WmsmDaVge0To_HY-soIdYQ2gZb2xwnvS78s6q0
## 2 AB3BwFqjspjbS18QHCoqmy08FP3FZgSlRJBQYrxZcqESUKtA3xsFWtc8NM381Mv2BoQ=
## 3 AB3BwFph6dXuICuvVWY5esR3NMNlwvGznYpvhtfWDwjLp9RrA5YhZrnQNyAiSFMuvldD
## 4 AB3BwFr8wZvzfgsg2okLSbgayIV5r-x_XQSKVHd6DSc-KLrXD_6rQH6Y2acQIHxi5Ywj
## 5 AB3BwFrazeDFD9JXW5cvjoaEp6QkZwbBgQdSj40737t-aqvLxoZhToIbX9EC4LhWoGrA
##                                                                          name
## 1 projects/736862006196/locations/us-central1/datasets/TBL3549743053705052160
## 2 projects/736862006196/locations/us-central1/datasets/TBL4800700863335104512
## 3 projects/736862006196/locations/us-central1/datasets/TBL4077180430816641024
## 4 projects/736862006196/locations/us-central1/datasets/TBL4897961462904913920
## 5 projects/736862006196/locations/us-central1/datasets/TBL7889488510502043648

Delete dataset

gcat_delete_result <- gcat_delete_dataset(displayName = "example_dataset01")
gcat_delete_result
## $name
## [1] "projects/736862006196/locations/us-central1/operations/TBL6055998170482081792"
## 
## $metadata
## $metadata$`@type`
## [1] "type.googleapis.com/google.cloud.automl.v1.OperationMetadata"
## 
## $metadata$createTime
## [1] "2021-04-21T00:46:40.750208Z"
## 
## $metadata$updateTime
## [1] "2021-04-21T00:46:40.750208Z"
## 
## $metadata$deleteDetails
## named list()
## 
## 
## $done
## [1] TRUE
## 
## $response
## $response$`@type`
## [1] "type.googleapis.com/google.protobuf.Empty"

List datasets

##   displayName          createTime
## 1  test_01_bq 2019-08-24 18:30:35
## 2 test_03_gcs 2020-03-26 19:17:53
## 3 test_02_gcs 2020-03-26 19:06:14
## 4     test_01 2019-06-20 12:26:51
##                                                                   etag
## 1 AB3BwFoH6y8gAII5oQAxE1jkoKDEYAsvpIeQDoYxCbfOdHLRiIKZFgkF8UQRff3vFO4=
## 2 AB3BwFroLW5mSQeV95zjE2YZpCTV4P92LA8BBaYyiqeMIxUOKAi-4xBP049wmSD7w9kE
## 3 AB3BwFrByDMR6oqJvioVnNpq2oKeCtvxc1ukhnsgG_fmWum20xRZdjlhMKXLq4jaqk5b
## 4 AB3BwFqwvel-mzozIaAtdFJTOgbHRDZIwBxFffTfHZtVJU9AhAIdSz3I2M6vkNMzhlRM
##                                                                          name
## 1 projects/736862006196/locations/us-central1/datasets/TBL4800700863335104512
## 2 projects/736862006196/locations/us-central1/datasets/TBL4077180430816641024
## 3 projects/736862006196/locations/us-central1/datasets/TBL4897961462904913920
## 4 projects/736862006196/locations/us-central1/datasets/TBL7889488510502043648