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(hostname = hostname, email = email, password = password, api_token =
    api_token),
  hostname = pal::pkg_config_val("hostname"),
  email = pal::pkg_config_val("email"),
  password = pal::pkg_config_val("password"),
  api_token = pal::pkg_config_val("api_token")
)

Arguments

id_data_src

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

name

Table name. A character scalar.

cols

Table columns specification as a list or something coercible to like a data frame.

title

NocoDB-specific table title. A character scalar.

meta

NocoDB-specific table metadata. A list.

order

A number to assign as the table's NocoDB-specific order "weight".

id_base

NocoDB base identifier as returned by base_id(). A character scalar.

hostname

NocoDB server hostname. A character scalar.

email

E-mail address of the NocoDB user to authenticate with.

password

Password of the NocoDB user to authenticate with.

api_token

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")))} # }