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,
token_name = "BANCTABLE_TOKEN",
workspace_id = "57832"
)
banctable_set_token(
user,
pwd,
url = "https://cloud.seatable.io/",
token_name = "BANCTABLE_TOKEN"
)
banctable_login(
url = "https://cloud.seatable.io/",
token_name = "BANCTABLE_TOKEN"
)
banctable_update_rows(
df,
table,
base = NULL,
append_allowed = FALSE,
chunksize = 1000L,
workspace_id = "57832",
token_name = "BANCTABLE_TOKEN",
...
)
banctable_move_to_bigdata(
table = "banc_meta",
base = "banc_meta",
url = "https://cloud.seatable.io/",
workspace_id = "57832",
token_name = "BANCTABLE_TOKEN",
where = "`region` = 'optic'",
invert = FALSE
)
banctable_append_rows(
df,
table,
bigdata = FALSE,
base = NULL,
chunksize = 1000L,
workspace_id = "57832",
token_name = "BANCTABLE_TOKEN",
...
)
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
.- token_name
The name of the token in your .Renviron file, should be
BANCTABLE_TOKEN
.- workspace_id
A numeric id specifying the workspace. Advanced use only
- user, pwd
banctable user and password used by
banctable_set_token
to obtain a token- url
Optional URL to the server
- 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.
- where
Optional SQL-like where clause to filter rows (default: NULL moves all rows)
- invert
whether to send the specified rows (
where
) to big data storage (FALSE
) or from storage to the 'normal' table (FALSE
.)- bigdata
logical, if
TRUE
new rows are added to the bigdata archive rather than the 'normal' seatable.
See also
fafbseg::flytable_query