Keboola Connection Storage API client
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

KBC Storage R Client

Build Status

Client for using Keboola Connection Storage API. This API client provides client methods to get data from KBC and put data back to KBC. See the documentation for more information.


# installation
# first need to install the devtools package if it isn't already installed
# load the library

# this package relies on another github package 
# for aws requests

# install the sapi client package

# load the library (dependencies will be loaded automatically)

# create client
client <- SapiClient$new(
    token = 'your-token'

# verify the token
tokenDetails <- client$verifyToken()

# create a bucket
bucket <- client$createBucket("new_bucket","in","A brand new Bucket!")

# create a table
table <- client$saveTable(myDataFrame, bucket$id, "new_table")
# note: as of version 0.2.0 if the table exists it will be over-written unless the incremental option is specified
table <- client$saveTable(myDataFrame, bucket$id, "existing_table", options = list(incremental = 1))

# import a table
mydata <- client$importTable('in.c-my_bucket.my_table')

# list buckets
buckets <- client$listBuckets()

# list all tables in a bucket
tables <- client$listTables(bucket = bucket$id)

# list all tables
tables <- client$listTables()

# delete table

# delete bucket

# list files with tag "my-tag"

# upload a file to sapi with tags "my-tag" and "our-tag"
newFileId <- client$putFile("path/to/my/file.whatever", tags=c("my-tag", "our-tag"))

# download a file from sapi
myFilePath <- client$loadFile(newFileId)
# now you can read it however you like (ex csv)
myFileContents <- read.csv(myFilePath)

# delete a file 

The only required argument to create a client is a valid Storage API token and API URL.