-
Notifications
You must be signed in to change notification settings - Fork 0
Updating an Attribute's Datatype
Bria Morgan edited this page Feb 2, 2023
·
1 revision
WDS will infer the datatype of a record's attributes. When adding or updating records for an existing type, WDS will update the datatype of an existing attribute to accommodate changes, if possible. For example, if a record type exists with a numeric attribute:
id | number |
---|---|
entity_1 | 123 |
entity_2 | 456 |
But a new record is uploaded to the type with a non-numeric value for the numeric attribute:
id | number |
---|---|
entity_3 | "hello" |
The record type will be updated and that attribute will now be typed as a string:
id | number |
---|---|
entity_1 | "123" |
entity_2 | "456" |
entity_3 | "hello" |
Most conversions will result in a string, as that is the most general datatype, with two exceptions:
- A date can be converted to a datetime, since no information is lost.
- Relations and arrays of relations cannot be updated. Attempts to update columns to or from relation attributes will result in error.
See the table below for full conversion behavior:
INCOMING DATATYPE → | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
EXISTING DATATYPE ↓ | boolean | number | string | date | datetime | relation | json | array of booleans | array of numbers | array of strings | array of dates | array of datetimes | array of relations |
boolean | boolean | string | string | string | string | ERROR | string | string | string | string | string | string | ERROR |
number | string | number | string | string | string | ERROR | string | string | string | string | string | string | ERROR |
string | string | string | string | string | string | ERROR | string | string | string | string | string | string | ERROR |
date | string | string | string | date | datetime | ERROR | string | string | string | string | string | string | ERROR |
datetime | string | string | string | string | datetime | ERROR | string | string | string | string | string | string | ERROR |
relation | ERROR | ERROR | ERROR | ERROR | ERROR | relation | ERROR | ERROR | ERROR | ERROR | ERROR | ERROR | ERROR |
json | string | string | string | string | string | ERROR | json | string | string | string | string | string | ERROR |
array of booleans | string | string | string | string | string | ERROR | string | array of booleans | string | string | string | string | ERROR |
array of numbers | string | string | string | string | string | ERROR | string | string | array of numbers | string | string | string | ERROR |
array of strings | string | string | string | string | string | ERROR | string | string | string | array of strings | string | string | ERROR |
array of dates | string | string | string | string | string | ERROR | string | string | string | string | array of dates | array of datetimes | ERROR |
array of datetimes | string | string | string | string | string | ERROR | string | string | string | string | string | array of datetimes | ERROR |
array of relations | ERROR | ERROR | ERROR | ERROR | ERROR | ERROR | ERROR | ERROR | ERROR | ERROR | ERROR | ERROR | array of relations |