Skip to main content

Columns

Each column has a data type. The data type constrains the set of possible values that can be assigned to a column and assigns semantics to the data stored in the column so that it can be used for computations. For instance, a column declared to be of a numerical type will not accept arbitrary text strings, and the data stored in such a column can be used for mathematical computations. By contrast, a column declared to be of a character string type will accept almost any kind of data but it does not lend itself to mathematical calculations, although other operations such as string concatenation are available.

Get column

You can either get a single column or a collection of columns.

All columns for a table
GET https://api.centia.io/api/v4/schemas/rockhall/tables/columns HTTP/1.1
Accept: application/json; charset=utf-8
Authorization: Bearer abc123
Specific column
GET https://api.centia.io/api/v4/schemas/rockhall/tables/inductees/colums/id HTTP/1.1
Accept: application/json; charset=utf-8
Authorization: Bearer abc123

A column object with nested objects looks like this. All properties prefixed with an _ (underscore) is read only. If submitted in a POST or PATCH they will be ignored.

{
"name": "id",
"type": "integer",
"is_nullable": false,
"default_value": null,
"comment": null,
"_num": 1,
"_full_type": "integer",
"_typname": "int4",
"_is_array": false,
"_character_maximum_length": null,
"_numeric_precision": 32,
"_numeric_scale": 0,
"_max_bytes": 4,
"_reference": null,
"_restriction": null,
"_is_primary": true,
"_is_unique": true,
"_index_method": [
"btree"
],
"_checks": null
}

Add column

Create new column
POST https://api.centia.io/api/v4/schemas/rockhall/tables/inductees HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123

{
"name": "id",
"type": "integer"
}
Create multiple columns
POST https://api.centia.io/api/v4/schemas/rockhall/tables/inductees HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123

{
"columns": [
{ "name": "id", "type": "integer"}
{ "name": "name", "type": "varchar(50)"}
]
}

Rename, set type, set nullable, set default

You can change name, type, default and nullable of a column or collection of columns.

PATCH https://api.centia.io/api/v4/schemas/rockhall/tables/inductees/columns/name HTTP/1.1
Content-Type: application/json
Authorization: Bearer abc123

{
"name": "name2",
"type": "varchar(100)",
"default": "Empty",
"nullable": false
}

Notes:

  • The type of a column can only be changed to a type that is compatible with the existing data.

Delete column

DELETE https://api.centia.io/api/v4/schemas/rockhall/tables/inductees/columns/id,name HTTP/1.1
Authorization: Bearer abc123