baserow.field_config
This module handles the config/properties of individual Baserow fields. These classes cannot be used to parse/validate data coming from Baserow.
1""" 2This module handles the config/properties of individual Baserow fields. These 3classes cannot be used to parse/validate data coming from Baserow. 4""" 5 6 7import abc 8from datetime import date, datetime, timedelta 9import enum 10import random 11 12from typing import Annotated, Any, Literal, Optional, Union 13from pydantic import UUID4, BaseModel, Field, RootModel 14 15from baserow.color import BasicColor, Color 16 17 18class FieldConfigBase(BaseModel, abc.ABC): 19 """ 20 Many of the fields (or rows) in Baserow tables have certain properties that 21 can be set. These are managed with this class. Each field type implements 22 its own Config class. Using these config classes, new fields can be created 23 in a table. 24 """ 25 name: Optional[str] = Field(max_length=255, default=None) 26 """Name of the field.""" 27 id: Optional[int] = None 28 """ 29 Field primary key. Can be used to generate the database column name by 30 adding field_ prefix. 31 """ 32 table_id: Optional[int] = None 33 """Related table id.""" 34 order: Optional[int] = None 35 """Field order in table. 0 for the first field.""" 36 primary: Optional[bool] = None 37 """ 38 Indicates if the field is a primary field. If `True` the field cannot be 39 deleted and the value should represent the whole row. 40 """ 41 read_only: Optional[bool] = None 42 """ 43 Indicates whether the field is a read only field. If true, it's not possible 44 to update the cell value. 45 """ 46 relate_fields: Optional[list[dict]] = None 47 description: Optional[str] = None 48 """ 49 Optional human readable description for the field. Displayed in Baserow. 50 """ 51 52 53class TextFieldConfig(FieldConfigBase): 54 """ 55 A single line text field is a type of field that allows you to input short 56 and unique pieces of text into your table. 57 """ 58 type: Literal["text"] = "text" 59 text_default: str = Field(default="", max_length=255) 60 61 62class LongTextFieldConfig(FieldConfigBase): 63 """ 64 A long text field can contain long paragraphs or multiple lines of text. 65 """ 66 type: Literal["long_text"] = "long_text" 67 long_text_enable_rich_text: Optional[bool] = False 68 69 70class URLFieldConfig(FieldConfigBase): 71 """The URL field holds a single URL.""" 72 type: Literal["url"] = "url" 73 74 75class EMailFieldConfig(FieldConfigBase): 76 """ 77 An email field is a type of field that allows input of a single email 78 address in a cell in the right format. When you click on an email address 79 inside of an email field, your computer's default email client will launch 80 with the clicked email's To: address in the To: field. 81 """ 82 type: Literal["email"] = "email" 83 84 85class NumberFieldConfig(FieldConfigBase): 86 """The number field is a field type that holds numerical values.""" 87 type: Literal["number"] = "number" 88 number_decimal_places: int = 0 89 """The amount of digits allowed after the point.""" 90 number_negative: bool = True 91 """Indicates if negative values are allowed.""" 92 93 94class RatingStyle(str, enum.Enum): 95 """Style of rating symbols.""" 96 STAR = "star" 97 HEART = "heart" 98 THUMBS_UP = "thumbs-up" 99 FLAG = "flag" 100 SMILE = "smile" 101 102 103class RatingFieldConfig(FieldConfigBase): 104 """ 105 A rating field is used to rate your rows in order to rank or evaluate their 106 quality. 107 """ 108 type: Literal["rating"] = "rating" 109 max_value: int = Field(default=5, ge=1, le=10) 110 """Maximum value the rating can take.""" 111 color: BasicColor = Field(default=BasicColor.DARK_BLUE) 112 """Color of the symbols.""" 113 style: RatingStyle = RatingStyle.STAR 114 """Style of rating symbols.""" 115 116 117class BooleanFieldConfig(FieldConfigBase): 118 """ 119 The boolean field represents information in a binary true/false format. 120 """ 121 type: Literal["boolean"] = "boolean" 122 123 124class DateFormat(str, enum.Enum): 125 """Format of the date-string.""" 126 EU = "EU" 127 """European, D/M/Y, 20/02/2020.""" 128 US = "US" 129 """US, M/D/Y, 02/20/2022.""" 130 ISO = "ISO" 131 """ISO, Y-M-D, 2020-02-20.""" 132 133 134class TimeFormat(int, enum.Enum): 135 """Format of the time. 24 or 23 hour.""" 136 HOUR_24 = 24 137 HOUR_12 = 12 138 139 140class GenericDateFieldConfig(FieldConfigBase): 141 """ 142 Generic date field config for all field types handling date(-time) values. 143 """ 144 date_format: DateFormat = DateFormat.ISO 145 """EU, US or ISO.""" 146 date_include_time: bool = False 147 """Indicates if the field also includes a time.""" 148 date_time_format: TimeFormat = TimeFormat.HOUR_24 149 """12 (am/pm) or 24 hour format.""" 150 date_show_tzinfo: bool = False 151 """Indicates if the timezone should be shown.""" 152 date_force_timezone: Optional[str] = Field(default=None, max_length=255) 153 """Force a timezone for the field overriding user profile settings.""" 154 date_force_timezone_offset: Optional[int] = Field(default=None) 155 """A UTC offset in minutes to add to all the field datetimes values.""" 156 157 158class DateFieldConfig(GenericDateFieldConfig): 159 """ 160 A UTC offset in minutes to add to all the field datetimes values. 161 """ 162 type: Literal["date"] = "date" 163 164 165class LastModifiedFieldConfig(GenericDateFieldConfig): 166 """ 167 The last modified field type returns the most recent date and time that a 168 row was modified. 169 """ 170 type: Literal["last_modified"] = "last_modified" 171 172 173class LastModifiedByFieldConfig(FieldConfigBase): 174 """ 175 Track decisions and actions to specific individuals for historical reference 176 or follow-up. 177 """ 178 type: Literal["last_modified_by"] = "last_modified_by" 179 180 181class CreatedOnFieldConfig(GenericDateFieldConfig): 182 """ 183 The created on field type will automatically show the date and time that a 184 row was created by a user. 185 """ 186 type: Literal["created_on"] = "created_on" 187 188 189class CreatedByFieldConfig(FieldConfigBase): 190 """ 191 Automatically tracks and displays the name of the collaborator who created 192 each row within a table. 193 """ 194 type: Literal["created_by"] = "created_by" 195 196 197class DurationFormat(str, enum.Enum): 198 """Possible display formats for durations.""" 199 HOURS_MINUTES = "h:mm" 200 HOURS_MINUTES_SECONDS = "h:mm:ss" 201 HOURS_MINUTES_SECONDS_DECISECONDS = "h:mm:ss.s" 202 HOURS_MINUTES_SECONDS_CENTISECONDS = "h:mm:ss.ss" 203 HOURS_MINUTES_SECONDS_MILLISECONDS = "h:mm:ss.sss" 204 DAYS_HOURS = "d h" 205 DAYS_HOURS_MINUTES = "d h:mm" 206 DAYS_HOURS_MINUTES_SECONDS = "d h:mm:ss" 207 208 209class DurationFieldConfig(FieldConfigBase): 210 """ 211 Stores time durations measured in hours, minutes, seconds, or milliseconds. 212 """ 213 type: Literal["duration"] = "duration" 214 duration_format: DurationFormat = DurationFormat.HOURS_MINUTES_SECONDS 215 """Possible display formats.""" 216 217 218class LinkFieldConfig(FieldConfigBase): 219 """ 220 A link to table field creates a link between two existing tables by 221 connecting data across tables with linked rows. 222 """ 223 type: Literal["link_row"] = "link_row" 224 link_row_table_id: int 225 """The id of the linked table.""" 226 has_related_field: bool = False 227 228 229class FileFieldConfig(FieldConfigBase): 230 """ 231 A file field allows you to easily upload one or more files from your device 232 or from a URL. 233 """ 234 type: Literal["file"] = "file" 235 236 237class SelectEntryConfig(BaseModel): 238 """Config for a entry in a single or multiple select field.""" 239 id: int 240 value: str = Field(max_length=255) 241 color: Color = Field(max_length=255, default=Color.DARK_BLUE) 242 243 244class SingleSelectFieldConfig(FieldConfigBase): 245 """ 246 The single select field type is a field type containing defined options to 247 choose only one option from a set of options. 248 """ 249 type: Literal["single_select"] = "single_select" 250 select_options: list[SelectEntryConfig] 251 252 253class MultipleSelectFieldConfig(FieldConfigBase): 254 """ 255 A multiple select field contains a list of tags to choose multiple options 256 from a set of options. 257 """ 258 type: Literal["multiple_select"] = "multiple_select" 259 select_options: list[SelectEntryConfig] 260 261 262class PhoneNumberFieldConfig(FieldConfigBase): 263 """ 264 The phone number field will format a string of numbers as a phone number, in 265 the form (XXX) XXX-XXXX. 266 """ 267 type: Literal["phone_number"] = "phone_number" 268 269 270class FormulaType(str, enum.Enum): 271 """Types of formula result value.""" 272 INVALID = "invalid" 273 TEXT = "text" 274 CHAR = "char" 275 BUTTON = "button" 276 LINK = "link" 277 DATE_INTERVAL = "date_interval" 278 DURATION = "duration" 279 DATE = "date" 280 BOOLEAN = "boolean" 281 NUMBER = "number" 282 ARRAY = "array" 283 SINGLE_SELECT = "single_select" 284 MULTIPLE_SELECT = "multiple_select" 285 SINGLE_FILE = "single_file" 286 287 288class GenericFormulaFieldConfig(FieldConfigBase): 289 """ 290 Generic type for fields which can contain all multiple fields types. 291 """ 292 date_show_tzinfo: Optional[bool] = False 293 """Indicates if the timezone should be shown.""" 294 number_decimal_places: Optional[int] = 0 295 """The amount of digits allowed after the point.""" 296 duration_format: Optional[DurationFormat] = DurationFormat.HOURS_MINUTES_SECONDS 297 """Possible display formats.""" 298 date_force_timezone: Optional[str] = Field(default=None, max_length=255) 299 """Force a timezone for the field overriding user profile settings.""" 300 array_formula_type: Optional[FormulaType] = None 301 """ 302 The type of the values within the array if `formula_type` is set to array. 303 Please note that the type array is not allowed. As an array within an array 304 is not possible in Baserow. 305 """ 306 error: Optional[str] = None 307 date_format: Optional[DateFormat] = DateFormat.ISO 308 """EU, US or ISO.""" 309 date_include_time: Optional[bool] = False 310 """Indicates if the field also includes a time.""" 311 date_time_format: Optional[TimeFormat] = TimeFormat.HOUR_24 312 """12 (am/pm) or 24 hour format.""" 313 formula: Optional[str] = None 314 """The actual formula.""" 315 formula_type: FormulaType 316 """Type of the formula result.""" 317 318 319class FormulaFieldConfig(GenericFormulaFieldConfig): 320 """ 321 A value in each row can be calculated using a formula based on values in 322 cells in the same row. 323 """ 324 type: Literal["formula"] = "formula" 325 326 327class CountFieldConfig(GenericFormulaFieldConfig): 328 """ 329 The count field will automatically count the number of rows linked to a 330 particular row in your database. 331 """ 332 type: Literal["count"] = "count" 333 334 335class RollupFieldConfig(GenericFormulaFieldConfig): 336 """Aggregate data and gain valuable insights from linked tables.""" 337 type: Literal["rollup"] = "rollup" 338 339 340class LookupFieldConfig(GenericFormulaFieldConfig): 341 """ 342 You can look for a specific field in a linked row using a lookup field. 343 """ 344 type: Literal["lookup"] = "lookup" 345 346 347class MultipleCollaboratorsFieldConfig(FieldConfigBase): 348 """ 349 Assign collaborators by selecting names from a list of workspace members. 350 """ 351 type: Literal["multiple_collaborators"] = "multiple_collaborators" 352 notify_user_when_added: bool = False 353 354 355class UUIDFieldConfig(FieldConfigBase): 356 """Create and work with unique record identifiers within a table.""" 357 type: Literal["uuid"] = "uuid" 358 359 360class AutonumberFieldConfig(FieldConfigBase): 361 """ 362 Automatically generates unique and sequential numbers for each record in a 363 table. 364 """ 365 type: Literal["autonumber"] = "autonumber" 366 view: Optional[int] = None 367 """The id of the view to use for the initial ordering.""" 368 369 370class PasswordFieldConfig(FieldConfigBase): 371 """ 372 Ensure robust security measures for your data. Currently only used for the 373 application builder. 374 """ 375 type: Literal["password"] = "password" 376 377 378class AIFieldConfig(FieldConfigBase): 379 """ 380 Generate creative briefs, summarize information, and more. 381 """ 382 type: Literal["ai"] = "ai" 383 ai_generative_ai_type: Optional[str] = Field(default=None, max_length=32) 384 ai_generative_ai_model: Optional[str] = Field(default=None, max_length=32) 385 ai_prompt: str = "" 386 """The prompt that must run for each row. Must be an formula.""" 387 388 389FieldConfigType = Annotated[ 390 Union[ 391 TextFieldConfig, 392 LongTextFieldConfig, 393 URLFieldConfig, 394 EMailFieldConfig, 395 NumberFieldConfig, 396 RatingFieldConfig, 397 BooleanFieldConfig, 398 DateFieldConfig, 399 LastModifiedFieldConfig, 400 LastModifiedByFieldConfig, 401 CreatedOnFieldConfig, 402 CreatedByFieldConfig, 403 DurationFieldConfig, 404 LinkFieldConfig, 405 FileFieldConfig, 406 SingleSelectFieldConfig, 407 MultipleSelectFieldConfig, 408 PhoneNumberFieldConfig, 409 FormulaFieldConfig, 410 CountFieldConfig, 411 RollupFieldConfig, 412 LookupFieldConfig, 413 MultipleCollaboratorsFieldConfig, 414 UUIDFieldConfig, 415 AutonumberFieldConfig, 416 PasswordFieldConfig, 417 AIFieldConfig, 418 ], 419 Field(discriminator="type"), 420] 421 422 423class FieldConfig(RootModel[FieldConfigType]): 424 root: FieldConfigType 425 426 427class Config: 428 """ 429 Encapsulates a FieldConfigType in a non-pydantic model. This is intended to 430 pass the configuration of a field in Baserow to a Table model using 431 typing.Annotated without causing a validation error. 432 433 Args: 434 config (FieldConfigType): An instance of a field config to be 435 encapsulated. 436 """ 437 438 def __init__(self, config: FieldConfigType): 439 self.config = config 440 441 442class PrimaryField: 443 """ 444 An instance of this class is used to specify, via type annotations, the 445 field of the table that should act as the primary field. Only one field per 446 table can be set as the primary field. 447 """ 448 449 450DEFAULT_CONFIG_FOR_BUILT_IN_TYPES: dict[Any, FieldConfigType] = { 451 bool: BooleanFieldConfig(), 452 bytes: TextFieldConfig(), 453 date: DateFieldConfig(), 454 datetime: DateFieldConfig(date_include_time=True), 455 float: NumberFieldConfig(number_decimal_places=3), 456 int: NumberFieldConfig(), 457 str: TextFieldConfig(), 458 timedelta: DurationFieldConfig(), 459 UUID4: UUIDFieldConfig(), 460} 461""" 462Dict mapping each built-in Python type to a Baserow filed config that should be 463used by default for that type. This information is used in the 464Table.create_table() method. For all types that cannot be mapped to a field type 465of a Baserow table, the value is None. 466"""
19class FieldConfigBase(BaseModel, abc.ABC): 20 """ 21 Many of the fields (or rows) in Baserow tables have certain properties that 22 can be set. These are managed with this class. Each field type implements 23 its own Config class. Using these config classes, new fields can be created 24 in a table. 25 """ 26 name: Optional[str] = Field(max_length=255, default=None) 27 """Name of the field.""" 28 id: Optional[int] = None 29 """ 30 Field primary key. Can be used to generate the database column name by 31 adding field_ prefix. 32 """ 33 table_id: Optional[int] = None 34 """Related table id.""" 35 order: Optional[int] = None 36 """Field order in table. 0 for the first field.""" 37 primary: Optional[bool] = None 38 """ 39 Indicates if the field is a primary field. If `True` the field cannot be 40 deleted and the value should represent the whole row. 41 """ 42 read_only: Optional[bool] = None 43 """ 44 Indicates whether the field is a read only field. If true, it's not possible 45 to update the cell value. 46 """ 47 relate_fields: Optional[list[dict]] = None 48 description: Optional[str] = None 49 """ 50 Optional human readable description for the field. Displayed in Baserow. 51 """
Many of the fields (or rows) in Baserow tables have certain properties that can be set. These are managed with this class. Each field type implements its own Config class. Using these config classes, new fields can be created in a table.
Field primary key. Can be used to generate the database column name by adding field_ prefix.
Indicates if the field is a primary field. If True
the field cannot be
deleted and the value should represent the whole row.
Indicates whether the field is a read only field. If true, it's not possible to update the cell value.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
54class TextFieldConfig(FieldConfigBase): 55 """ 56 A single line text field is a type of field that allows you to input short 57 and unique pieces of text into your table. 58 """ 59 type: Literal["text"] = "text" 60 text_default: str = Field(default="", max_length=255)
A single line text field is a type of field that allows you to input short and unique pieces of text into your table.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
63class LongTextFieldConfig(FieldConfigBase): 64 """ 65 A long text field can contain long paragraphs or multiple lines of text. 66 """ 67 type: Literal["long_text"] = "long_text" 68 long_text_enable_rich_text: Optional[bool] = False
A long text field can contain long paragraphs or multiple lines of text.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
71class URLFieldConfig(FieldConfigBase): 72 """The URL field holds a single URL.""" 73 type: Literal["url"] = "url"
The URL field holds a single URL.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
76class EMailFieldConfig(FieldConfigBase): 77 """ 78 An email field is a type of field that allows input of a single email 79 address in a cell in the right format. When you click on an email address 80 inside of an email field, your computer's default email client will launch 81 with the clicked email's To: address in the To: field. 82 """ 83 type: Literal["email"] = "email"
An email field is a type of field that allows input of a single email address in a cell in the right format. When you click on an email address inside of an email field, your computer's default email client will launch with the clicked email's To: address in the To: field.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
86class NumberFieldConfig(FieldConfigBase): 87 """The number field is a field type that holds numerical values.""" 88 type: Literal["number"] = "number" 89 number_decimal_places: int = 0 90 """The amount of digits allowed after the point.""" 91 number_negative: bool = True 92 """Indicates if negative values are allowed."""
The number field is a field type that holds numerical values.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
95class RatingStyle(str, enum.Enum): 96 """Style of rating symbols.""" 97 STAR = "star" 98 HEART = "heart" 99 THUMBS_UP = "thumbs-up" 100 FLAG = "flag" 101 SMILE = "smile"
Style of rating symbols.
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
104class RatingFieldConfig(FieldConfigBase): 105 """ 106 A rating field is used to rate your rows in order to rank or evaluate their 107 quality. 108 """ 109 type: Literal["rating"] = "rating" 110 max_value: int = Field(default=5, ge=1, le=10) 111 """Maximum value the rating can take.""" 112 color: BasicColor = Field(default=BasicColor.DARK_BLUE) 113 """Color of the symbols.""" 114 style: RatingStyle = RatingStyle.STAR 115 """Style of rating symbols."""
A rating field is used to rate your rows in order to rank or evaluate their quality.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
118class BooleanFieldConfig(FieldConfigBase): 119 """ 120 The boolean field represents information in a binary true/false format. 121 """ 122 type: Literal["boolean"] = "boolean"
The boolean field represents information in a binary true/false format.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
125class DateFormat(str, enum.Enum): 126 """Format of the date-string.""" 127 EU = "EU" 128 """European, D/M/Y, 20/02/2020.""" 129 US = "US" 130 """US, M/D/Y, 02/20/2022.""" 131 ISO = "ISO" 132 """ISO, Y-M-D, 2020-02-20."""
Format of the date-string.
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
135class TimeFormat(int, enum.Enum): 136 """Format of the time. 24 or 23 hour.""" 137 HOUR_24 = 24 138 HOUR_12 = 12
Format of the time. 24 or 23 hour.
Inherited Members
- enum.Enum
- name
- value
- builtins.int
- conjugate
- bit_length
- bit_count
- to_bytes
- from_bytes
- as_integer_ratio
- is_integer
- real
- imag
- numerator
- denominator
141class GenericDateFieldConfig(FieldConfigBase): 142 """ 143 Generic date field config for all field types handling date(-time) values. 144 """ 145 date_format: DateFormat = DateFormat.ISO 146 """EU, US or ISO.""" 147 date_include_time: bool = False 148 """Indicates if the field also includes a time.""" 149 date_time_format: TimeFormat = TimeFormat.HOUR_24 150 """12 (am/pm) or 24 hour format.""" 151 date_show_tzinfo: bool = False 152 """Indicates if the timezone should be shown.""" 153 date_force_timezone: Optional[str] = Field(default=None, max_length=255) 154 """Force a timezone for the field overriding user profile settings.""" 155 date_force_timezone_offset: Optional[int] = Field(default=None) 156 """A UTC offset in minutes to add to all the field datetimes values."""
Generic date field config for all field types handling date(-time) values.
A UTC offset in minutes to add to all the field datetimes values.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
159class DateFieldConfig(GenericDateFieldConfig): 160 """ 161 A UTC offset in minutes to add to all the field datetimes values. 162 """ 163 type: Literal["date"] = "date"
A UTC offset in minutes to add to all the field datetimes values.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
166class LastModifiedFieldConfig(GenericDateFieldConfig): 167 """ 168 The last modified field type returns the most recent date and time that a 169 row was modified. 170 """ 171 type: Literal["last_modified"] = "last_modified"
The last modified field type returns the most recent date and time that a row was modified.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
174class LastModifiedByFieldConfig(FieldConfigBase): 175 """ 176 Track decisions and actions to specific individuals for historical reference 177 or follow-up. 178 """ 179 type: Literal["last_modified_by"] = "last_modified_by"
Track decisions and actions to specific individuals for historical reference or follow-up.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
182class CreatedOnFieldConfig(GenericDateFieldConfig): 183 """ 184 The created on field type will automatically show the date and time that a 185 row was created by a user. 186 """ 187 type: Literal["created_on"] = "created_on"
The created on field type will automatically show the date and time that a row was created by a user.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
190class CreatedByFieldConfig(FieldConfigBase): 191 """ 192 Automatically tracks and displays the name of the collaborator who created 193 each row within a table. 194 """ 195 type: Literal["created_by"] = "created_by"
Automatically tracks and displays the name of the collaborator who created each row within a table.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
198class DurationFormat(str, enum.Enum): 199 """Possible display formats for durations.""" 200 HOURS_MINUTES = "h:mm" 201 HOURS_MINUTES_SECONDS = "h:mm:ss" 202 HOURS_MINUTES_SECONDS_DECISECONDS = "h:mm:ss.s" 203 HOURS_MINUTES_SECONDS_CENTISECONDS = "h:mm:ss.ss" 204 HOURS_MINUTES_SECONDS_MILLISECONDS = "h:mm:ss.sss" 205 DAYS_HOURS = "d h" 206 DAYS_HOURS_MINUTES = "d h:mm" 207 DAYS_HOURS_MINUTES_SECONDS = "d h:mm:ss"
Possible display formats for durations.
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
210class DurationFieldConfig(FieldConfigBase): 211 """ 212 Stores time durations measured in hours, minutes, seconds, or milliseconds. 213 """ 214 type: Literal["duration"] = "duration" 215 duration_format: DurationFormat = DurationFormat.HOURS_MINUTES_SECONDS 216 """Possible display formats."""
Stores time durations measured in hours, minutes, seconds, or milliseconds.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
219class LinkFieldConfig(FieldConfigBase): 220 """ 221 A link to table field creates a link between two existing tables by 222 connecting data across tables with linked rows. 223 """ 224 type: Literal["link_row"] = "link_row" 225 link_row_table_id: int 226 """The id of the linked table.""" 227 has_related_field: bool = False
A link to table field creates a link between two existing tables by connecting data across tables with linked rows.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
230class FileFieldConfig(FieldConfigBase): 231 """ 232 A file field allows you to easily upload one or more files from your device 233 or from a URL. 234 """ 235 type: Literal["file"] = "file"
A file field allows you to easily upload one or more files from your device or from a URL.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
238class SelectEntryConfig(BaseModel): 239 """Config for a entry in a single or multiple select field.""" 240 id: int 241 value: str = Field(max_length=255) 242 color: Color = Field(max_length=255, default=Color.DARK_BLUE)
Config for a entry in a single or multiple select field.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
245class SingleSelectFieldConfig(FieldConfigBase): 246 """ 247 The single select field type is a field type containing defined options to 248 choose only one option from a set of options. 249 """ 250 type: Literal["single_select"] = "single_select" 251 select_options: list[SelectEntryConfig]
The single select field type is a field type containing defined options to choose only one option from a set of options.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
254class MultipleSelectFieldConfig(FieldConfigBase): 255 """ 256 A multiple select field contains a list of tags to choose multiple options 257 from a set of options. 258 """ 259 type: Literal["multiple_select"] = "multiple_select" 260 select_options: list[SelectEntryConfig]
A multiple select field contains a list of tags to choose multiple options from a set of options.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
263class PhoneNumberFieldConfig(FieldConfigBase): 264 """ 265 The phone number field will format a string of numbers as a phone number, in 266 the form (XXX) XXX-XXXX. 267 """ 268 type: Literal["phone_number"] = "phone_number"
The phone number field will format a string of numbers as a phone number, in the form (XXX) XXX-XXXX.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
271class FormulaType(str, enum.Enum): 272 """Types of formula result value.""" 273 INVALID = "invalid" 274 TEXT = "text" 275 CHAR = "char" 276 BUTTON = "button" 277 LINK = "link" 278 DATE_INTERVAL = "date_interval" 279 DURATION = "duration" 280 DATE = "date" 281 BOOLEAN = "boolean" 282 NUMBER = "number" 283 ARRAY = "array" 284 SINGLE_SELECT = "single_select" 285 MULTIPLE_SELECT = "multiple_select" 286 SINGLE_FILE = "single_file"
Types of formula result value.
Inherited Members
- enum.Enum
- name
- value
- builtins.str
- encode
- replace
- split
- rsplit
- join
- capitalize
- casefold
- title
- center
- count
- expandtabs
- find
- partition
- index
- ljust
- lower
- lstrip
- rfind
- rindex
- rjust
- rstrip
- rpartition
- splitlines
- strip
- swapcase
- translate
- upper
- startswith
- endswith
- removeprefix
- removesuffix
- isascii
- islower
- isupper
- istitle
- isspace
- isdecimal
- isdigit
- isnumeric
- isalpha
- isalnum
- isidentifier
- isprintable
- zfill
- format
- format_map
- maketrans
289class GenericFormulaFieldConfig(FieldConfigBase): 290 """ 291 Generic type for fields which can contain all multiple fields types. 292 """ 293 date_show_tzinfo: Optional[bool] = False 294 """Indicates if the timezone should be shown.""" 295 number_decimal_places: Optional[int] = 0 296 """The amount of digits allowed after the point.""" 297 duration_format: Optional[DurationFormat] = DurationFormat.HOURS_MINUTES_SECONDS 298 """Possible display formats.""" 299 date_force_timezone: Optional[str] = Field(default=None, max_length=255) 300 """Force a timezone for the field overriding user profile settings.""" 301 array_formula_type: Optional[FormulaType] = None 302 """ 303 The type of the values within the array if `formula_type` is set to array. 304 Please note that the type array is not allowed. As an array within an array 305 is not possible in Baserow. 306 """ 307 error: Optional[str] = None 308 date_format: Optional[DateFormat] = DateFormat.ISO 309 """EU, US or ISO.""" 310 date_include_time: Optional[bool] = False 311 """Indicates if the field also includes a time.""" 312 date_time_format: Optional[TimeFormat] = TimeFormat.HOUR_24 313 """12 (am/pm) or 24 hour format.""" 314 formula: Optional[str] = None 315 """The actual formula.""" 316 formula_type: FormulaType 317 """Type of the formula result."""
Generic type for fields which can contain all multiple fields types.
The type of the values within the array if formula_type
is set to array.
Please note that the type array is not allowed. As an array within an array
is not possible in Baserow.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
320class FormulaFieldConfig(GenericFormulaFieldConfig): 321 """ 322 A value in each row can be calculated using a formula based on values in 323 cells in the same row. 324 """ 325 type: Literal["formula"] = "formula"
A value in each row can be calculated using a formula based on values in cells in the same row.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
328class CountFieldConfig(GenericFormulaFieldConfig): 329 """ 330 The count field will automatically count the number of rows linked to a 331 particular row in your database. 332 """ 333 type: Literal["count"] = "count"
The count field will automatically count the number of rows linked to a particular row in your database.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
336class RollupFieldConfig(GenericFormulaFieldConfig): 337 """Aggregate data and gain valuable insights from linked tables.""" 338 type: Literal["rollup"] = "rollup"
Aggregate data and gain valuable insights from linked tables.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
341class LookupFieldConfig(GenericFormulaFieldConfig): 342 """ 343 You can look for a specific field in a linked row using a lookup field. 344 """ 345 type: Literal["lookup"] = "lookup"
You can look for a specific field in a linked row using a lookup field.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
348class MultipleCollaboratorsFieldConfig(FieldConfigBase): 349 """ 350 Assign collaborators by selecting names from a list of workspace members. 351 """ 352 type: Literal["multiple_collaborators"] = "multiple_collaborators" 353 notify_user_when_added: bool = False
Assign collaborators by selecting names from a list of workspace members.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
356class UUIDFieldConfig(FieldConfigBase): 357 """Create and work with unique record identifiers within a table.""" 358 type: Literal["uuid"] = "uuid"
Create and work with unique record identifiers within a table.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
361class AutonumberFieldConfig(FieldConfigBase): 362 """ 363 Automatically generates unique and sequential numbers for each record in a 364 table. 365 """ 366 type: Literal["autonumber"] = "autonumber" 367 view: Optional[int] = None 368 """The id of the view to use for the initial ordering."""
Automatically generates unique and sequential numbers for each record in a table.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
371class PasswordFieldConfig(FieldConfigBase): 372 """ 373 Ensure robust security measures for your data. Currently only used for the 374 application builder. 375 """ 376 type: Literal["password"] = "password"
Ensure robust security measures for your data. Currently only used for the application builder.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
379class AIFieldConfig(FieldConfigBase): 380 """ 381 Generate creative briefs, summarize information, and more. 382 """ 383 type: Literal["ai"] = "ai" 384 ai_generative_ai_type: Optional[str] = Field(default=None, max_length=32) 385 ai_generative_ai_model: Optional[str] = Field(default=None, max_length=32) 386 ai_prompt: str = "" 387 """The prompt that must run for each row. Must be an formula."""
Generate creative briefs, summarize information, and more.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
Usage docs: https://docs.pydantic.dev/2.8/concepts/models/#rootmodel-and-custom-root-types
A Pydantic BaseModel
for the root object of the model.
Attributes:
- root: The root object of the model.
- __pydantic_root_model__: Whether the model is a RootModel.
- __pydantic_private__: Private fields in the model.
- __pydantic_extra__: Extra fields in the model.
Inherited Members
- pydantic.main.BaseModel
- BaseModel
- model_config
- model_extra
- model_fields_set
- model_construct
- model_copy
- model_dump
- model_dump_json
- model_json_schema
- model_parametrized_name
- model_post_init
- model_rebuild
- model_validate
- model_validate_json
- model_validate_strings
- dict
- json
- parse_obj
- parse_raw
- parse_file
- from_orm
- construct
- copy
- schema
- schema_json
- validate
- update_forward_refs
- model_fields
- model_computed_fields
428class Config: 429 """ 430 Encapsulates a FieldConfigType in a non-pydantic model. This is intended to 431 pass the configuration of a field in Baserow to a Table model using 432 typing.Annotated without causing a validation error. 433 434 Args: 435 config (FieldConfigType): An instance of a field config to be 436 encapsulated. 437 """ 438 439 def __init__(self, config: FieldConfigType): 440 self.config = config
Encapsulates a FieldConfigType in a non-pydantic model. This is intended to pass the configuration of a field in Baserow to a Table model using typing.Annotated without causing a validation error.
Arguments:
- config (FieldConfigType): An instance of a field config to be encapsulated.
443class PrimaryField: 444 """ 445 An instance of this class is used to specify, via type annotations, the 446 field of the table that should act as the primary field. Only one field per 447 table can be set as the primary field. 448 """
An instance of this class is used to specify, via type annotations, the field of the table that should act as the primary field. Only one field per table can be set as the primary field.
Dict mapping each built-in Python type to a Baserow filed config that should be used by default for that type. This information is used in the Table.create_table() method. For all types that cannot be mapped to a field type of a Baserow table, the value is None.