Skip to contents

Adds a new table in the specified data source of the specified base on a NocoDB server via its POST /api/v2/meta/bases/{id_base}/{id_data_src}/tables API endpoint.

Usage

create_data_src_tbl(
  id_data_src,
  name,
  cols,
  title = NULL,
  meta = NULL,
  order = NULL,
  id_base = base_id(origin = origin, email = email, password = password, api_token =
    api_token),
  origin = pal::pkg_config_val("origin"),
  email = pal::pkg_config_val("email"),
  password = pal::pkg_config_val("password"),
  api_token = pal::pkg_config_val("api_token")
)

Arguments

id_data_src

character(1)
NocoDB data source identifier as returned by data_src_id().

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 NocoDB-specific order "weight".

id_base

character(1)
NocoDB base identifier as returned by base_id().

origin

character(1)
NocoDB server origin.

email

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 over email and password if provided.

Value

A tibble with metadata about the newly created NocoDB table, invisibly.

See also

Other functions to manage NocoDB base data sources: create_data_src(), data_src(), data_src_diff(), data_src_id(), data_src_tbls(), data_srcs(), delete_data_src(), has_data_src_diff(), sync_data_src(), test_data_src(), update_data_src()

Other functions to manage NocoDB tables: create_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_data_src_tbl(id_data_src = "REPLACE-ME",
                            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")))} # }