Skip to contents

Updates the metadata of the specified table column on a NocoDB server via its PATCH /api/v2/meta/columns/{id_col} API endpoint.

Beware that this API endpoint always alters the schema of the underlying table, which might be undesirable, especially if the table belongs to an external data source.

Usage

update_tbl_col(
  id_col,
  column_name = NULL,
  title = NULL,
  description = NULL,
  uidt = NULL,
  colOptions = NULL,
  dt = NULL,
  cdf = NULL,
  rqd = NULL,
  pk = NULL,
  ai = NULL,
  au = NULL,
  un = NULL,
  dtx = NULL,
  dtxp = NULL,
  dtxs = NULL,
  enable_rich_text = NULL,
  origin = funky::config_val("origin"),
  email = funky::config_val("email"),
  password = funky::config_val("password"),
  api_token = funky::config_val("api_token"),
  quiet = FALSE
)

Arguments

id_col

character(1)
NocoDB column identifier as returned by tbl_col_id().

column_name

character(1)
Column name. Omitted if NULL.

title

character(1)
NocoDB column title. Omitted if NULL.

description

character(1)
NocoDB column description displayed as a tooltip in the column header. Omitted if NULL. Set description = "" to remove an existing description value.

uidt

character(1)
NocoDB user interface data type. Either NULL for the column's current uidt value or one of

  • "AI"

  • "Attachment"

  • "AutoNumber"

  • "Barcode"

  • "Button"

  • "Checkbox"

  • "Collaborator"

  • "Count"

  • "CreatedBy"

  • "CreatedTime"

  • "Currency"

  • "Date"

  • "DateTime"

  • "Decimal"

  • "Duration"

  • "Email"

  • "ForeignKey"

  • "Formula"

  • "GeoData"

  • "Geometry"

  • "ID"

  • "JSON"

  • "LastModifiedBy"

  • "LastModifiedTime"

  • "Links"

  • "LinkToAnotherRecord"

  • "LongText"

  • "Lookup"

  • "MultiSelect"

  • "Number"

  • "Order"

  • "Percent"

  • "PhoneNumber"

  • "QrCode"

  • "Rating"

  • "Rollup"

  • "SingleLineText"

  • "SingleSelect"

  • "SpecificDBType"

  • "Time"

  • "URL"

  • "User"

  • "Year" .

colOptions

list()
NocoDB column options. To specify the values for a single-select field (uidt = "SingleSelect"), supply a data frame with the columns title, color (HEX color code) and index (counted from 0 upwards) as a list element named options. Defaults to the column's current colOptions value if NULL.

dt

character(1)
Column data type. Omitted if NULL.

cdf

character(1)
Column default value. Defaults to the column's current cdf value if NULL. Set cdf = NA to remove an existing cdf value.

rqd

logical(1)
Whether or not the column is required to be filled, i.e. should have a NOT NULL constraint. Corresponds to the NN advanced field attribute. Defaults to the column's current rqd value if NULL.

pk

logical(1)
Whether or not the column is a primary key, should have a PRIMARY KEY constraint. Corresponds to the PK advanced field attribute. Defaults to the column's current pk value if NULL.

ai

logical(1)
Whether or not to auto-increment the column value on new record insertion. Corresponds to the AI advanced field attribute. Defaults to the column's current ai value if NULL.

au

logical(1)
Whether or not to auto-update the column value to the current timestamp on record creation/insertion. Corresponds to the AU advanced field attribute. Defaults to the column's current au value if NULL.

un

logical(1)
Whether or not the column is an unsigned number, i.e. can only store non-negative numbers. Corresponds to the UN advanced field attribute. Defaults to the column's current un value if NULL.

dtx

Data type x. Defaults to the column's current dtx value if NULL.

dtxp

Data type x precision. Omitted if NULL.

dtxs

Data type x scale. Omitted if NULL.

enable_rich_text

logical(1)
Whether or not to enable rich text support for the column in NocoDB. Only applicable if uidt = "LongText". Omitted if NULL.

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.

quiet

logical(1)
Whether or not to suppress printing status output from internal processing.

Value

A tibble with metadata about the NocoDB table to which the updated column belongs, invisibly.

See also

Other functions to manage NocoDB table columns: create_tbl_col(), delete_tbl_col(), set_display_val(), set_display_vals(), tbl_col(), tbl_col_id(), tbl_cols()