Adds a new table to the specified base's default data source on a NocoDB server via its
POST /api/v2/meta/bases/{id_base}/tables API endpoint.
To add a new table to a specific (external) data source, use create_data_src_tbl() instead.
Usage
create_tbl(
name,
cols,
title = NULL,
meta = NULL,
order = NULL,
id_base = base_id(origin = origin, email = email, password = password, api_token =
api_token),
origin = funky::config_val("origin"),
email = funky::config_val("email"),
password = funky::config_val("password"),
api_token = funky::config_val("api_token")
)Arguments
- name
character(1)
Table name.- cols
list()
Table columns specification as a list or something coercible to like a data frame.- title
character(1)
NocoDB-specific table title.- meta
list()
NocoDB-specific table metadata as a list or something coercible to like a data frame.- order
integer(1)
A number to assign as the table's UI order "weight".- id_base
character(1)
NocoDB base identifier as returned bybase_id().- origin
character(1)
NocoDB server origin.character(1)
E-mail address of the NocoDB user to authenticate with.- password
character(1)
Password of the NocoDB user to authenticate with.- api_token
character(1)
NocoDB API token. Takes precedence overemailandpasswordif provided.
Value
A tibble with metadata about the newly created NocoDB table, invisibly.
Details
Besides the specified cols, NocoDB automatically creates the additional columns
created_at,
updated_at,
created_by and
updated_by as system fields.
See also
Other functions to manage NocoDB tables:
create_data_src_tbl(),
data_src_tbls(),
delete_tbl(),
reorder_tbl(),
set_tbl_metadata(),
tbl,
tbl_id(),
tbls(),
update_tbl()
Examples
if (FALSE) { # \dontrun{
# create new table with a single PK column
nocodb::create_tbl(name = "my_new_table",
title = "MyNewTable",
cols = list(list(column_name = "id",
title = "id",
dt = "text",
dtx = "text",
nrqd = FALSE,
rqd = TRUE,
ck = FALSE,
pk = TRUE,
un = FALSE,
ai = FALSE,
uidt = "LongText")))} # }