Skip to contents

These functions use the logic and wrap some code from the flytable_.* functions in the fafbseg R package. banctable_set_token will obtain and store a permanent seatable user-level API token. banctable_query performs a SQL query against a banctable database. You can omit the base argument unless you have tables of the same name in different bases. banctable_base returns a base object (equivalent to a mysql database) which allows you to access one or more tables, logging in to the service if necessary. The returned base object give you full access to the Python Base API allowing a range of row/column manipulations. banctable_update_rows updates existing rows in a table, returning TRUE on success.

Usage

banctable_query(
  sql = "SELECT * FROM banc_meta",
  limit = 200000L,
  base = NULL,
  python = FALSE,
  convert = TRUE,
  ac = NULL
)

banctable_set_token(user, pwd, url = "https://cloud.seatable.io/")

banctable_login(
  url = "https://cloud.seatable.io/",
  token = Sys.getenv("BANCTABLE_TOKEN", unset = NA_character_)
)

banctable_update_rows(
  df,
  table,
  base = NULL,
  append_allowed = FALSE,
  chunksize = 1000L,
  ...
)

banctable_append_rows(df, table, base = NULL, chunksize = 1000L, ...)

Arguments

sql

A SQL query string. See examples and seatable docs.

limit

An optional limit, which only applies if you do not specify a limit directly in the sql query. By default seatable limits SQL queries to 100 rows. We increase the limit to 100000 rows by default.

base

Character vector specifying the base

python

Logical. Whether to return a Python pandas DataFrame. The default of FALSE returns an R data.frame

convert

Expert use only: Whether or not to allow the Python seatable module to process raw output from the database. This is is principally for debugging purposes. NB this imposes a requirement of seatable_api >=2.4.0.

ac

A seatable connection object as returned by banctable_login.

user, pwd

banctable user and password used by banctable_set_token to obtain a token

url

Optional URL to the server

token

normally retrieved from BANCTABLE_TOKEN environment variable.

df

A data.frame containing the data to upload including an _id column that can identify each row in the remote table.

table

Character vector specifying a table foe which you want a base object.

append_allowed

Logical. Whether rows without row identifiers can be appended.

chunksize

To split large requests into smaller ones with max this many rows.

...

Additional arguments passed to pbsapply which might include cl=2 to specify a number of parallel jobs to run.

Value

a data.frame of results. There should be 0 rows if no rows matched query.

See also

Examples

if (FALSE) { # \dontrun{
# Do this once
banctable_set_token(user="MY_EMAIL_FOR_SEATABLE.com",
                    pwd="MY_SEATABLE_PASSWORD",
                    url="https://cloud.seatable.io/")

# Thereafter:
banc.meta <- banctable_query()
} # }