Skip to content

Schema

schema

Objects representing a database schema.

Properties are used when

  1. a database with a specific schema is created,
  2. a database with a schema is retrieved.

Unfortunately, the way a schema is defined in case of 1. and 2. is not consistent. In case 1., the property name is only defined as a key while in case 2. it is additionally defined as name attribute of the property object. We treat these two cases the same way when constructing the property objects. For this reason name is Unset by default.

GO_co = TypeVar('GO_co', bound=GenericObject, covariant=True, default=GenericObject) module-attribute

Button

Button database property.

button: ButtonTypeData = Field(default_factory=ButtonTypeData) class-attribute instance-attribute

ButtonTypeData

Type data for Button.

Checkbox

Defines the checkbox configuration for a database property.

checkbox: CheckboxTypeData = Field(default_factory=CheckboxTypeData) class-attribute instance-attribute

CheckboxTypeData

Type data for Checkbox.

CreatedBy

Defines the created-by configuration for a database property.

created_by: CreatedByTypeData = Field(default_factory=CreatedByTypeData) class-attribute instance-attribute

CreatedByTypeData

Type data for CreatedBy.

CreatedTime

Defines the created-time configuration for a database property.

created_time: CreatedTimeTypeData = Field(default_factory=CreatedTimeTypeData) class-attribute instance-attribute

CreatedTimeTypeData

Type data for CreatedTime.

Date

Defines the date configuration for a database property.

date: DateTypeData = Field(default_factory=DateTypeData) class-attribute instance-attribute

DateTypeData

Type data for Date.

DualPropertyRelation

Defines a two-way relation configuration for a database property.

If a two-way relation property X relates to Y then the two-way relation property Y relates to X.

dual_property: DualPropertyRelationTypeData = Field(default_factory=DualPropertyRelationTypeData) class-attribute instance-attribute

build_relation(dbref: UUID) -> Relation classmethod

Create a dual_property relation using the target database reference.

dbref must be either a string or UUID.

DualPropertyRelationTypeData

Type data for DualPropertyRelation.

synced_property_id: str | UnsetType = Unset class-attribute instance-attribute

synced_property_name: str | UnsetType = Unset class-attribute instance-attribute

__eq__(other: object) -> bool

Compare DualPropertyRelation objects by all attributes except id.

__hash__() -> int

Return a hash of the DualPropertyRelation TypeData based on synced_property_name.

Email

Defines the email configuration for a database property.

email: EmailTypeData = Field(default_factory=EmailTypeData) class-attribute instance-attribute

EmailTypeData

Type data for Email.

Files

Defines the files configuration for a database property.

files: FilesTypeData = Field(default_factory=FilesTypeData) class-attribute instance-attribute

FilesTypeData

Type data for Files.

Formula

Defines the formula configuration for a database property.

formula: FormulaTypeData instance-attribute

build(formula: str) -> Formula classmethod

FormulaTypeData

Type data for Formula.

expression: str instance-attribute

__eq__(other: object) -> bool

Compare Formula objects by all attributes except id.

__hash__() -> int

Return a hash of the Formula TypeData.

Since eq always returns True due to API expression transformation, we use a constant hash to maintain consistency with equality.

LastEditedBy

Defines the last-edited-by configuration for a database property.

last_edited_by: LastEditedByTypeData = Field(default_factory=LastEditedByTypeData) class-attribute instance-attribute

LastEditedByTypeData

Type data for LastEditedBy.

LastEditedTime

Defines the last-edited-time configuration for a database property.

last_edited_time: LastEditedTimeTypeData = Field(default_factory=LastEditedTimeTypeData) class-attribute instance-attribute

LastEditedTimeTypeData

Type data for LastEditedTime.

MultiSelect

Defines the multi-select configuration for a database property.

multi_select: MultiSelectTypeData = Field(default_factory=MultiSelectTypeData) class-attribute instance-attribute

build(options: list[SelectOption]) -> MultiSelect classmethod

Create a Select object from the list of SelectOption's.

MultiSelectTypeData

Type data for MultiSelect.

options: list[SelectOption] = Field(default_factory=list) class-attribute instance-attribute

Number

Defines the number configuration for a database property.

number: NumberTypeData = Field(default_factory=NumberTypeData) class-attribute instance-attribute

build(format: NumberFormat) -> Number classmethod

Create a Number object with the expected format.

NumberTypeData

Type data for Number.

format: NumberFormat = NumberFormat.NUMBER class-attribute instance-attribute

validate_enum_field(field: str) -> NumberFormat classmethod

People

Defines the people configuration for a database property.

people: PeopleTypeData = Field(default_factory=PeopleTypeData) class-attribute instance-attribute

PeopleTypeData

Type data for People.

PhoneNumber

Defines the phone number configuration for a database property.

phone_number: PhoneNumberTypeData = Field(default_factory=PhoneNumberTypeData) class-attribute instance-attribute

PhoneNumberTypeData

Type data for PhoneNumber.

Property

Base class for Notion property objects.

description: str | None = None class-attribute instance-attribute

id: str | UnsetType = Unset class-attribute instance-attribute

name: str | UnsetType = Unset class-attribute instance-attribute

PropertyRelation

Defines common configuration for a property relation.

data_source_id: str | None = None class-attribute instance-attribute

database_id: UUID instance-attribute

__eq__(other: object) -> bool

__hash__() -> int

Relation

Defines the relation configuration for a database property.

relation: SinglePropertyRelation | DualPropertyRelation instance-attribute

RenameProp

Property to rename a property during a database update.

name: str instance-attribute

RichText

Defines the rich text configuration for a database property.

rich_text: RichTextTypeData = Field(default_factory=RichTextTypeData) class-attribute instance-attribute

RichTextTypeData

Type data for RichText.

Rollup

Defines the rollup configuration for a database property.

rollup: RollupTypeData instance-attribute

build(relation: str, property: str, function: AggFunc) -> Rollup classmethod

RollupTypeData

Type data for Rollup.

function: AggFunc = AggFunc.COUNT_ALL class-attribute instance-attribute

relation_property_id: str | UnsetType = Unset class-attribute instance-attribute

relation_property_name: str instance-attribute

rollup_property_id: str | UnsetType = Unset class-attribute instance-attribute

rollup_property_name: str instance-attribute

__eq__(value: object) -> bool

Compare Rollup objects by all attributes except id.

__hash__() -> int

Return a hash of the Rollup TypeData based on function and property names.

validate_enum_field(field: str) -> AggFunc classmethod

Select

Defines the select configuration for a database property.

select: SelectTypeData = Field(default_factory=SelectTypeData) class-attribute instance-attribute

build(options: list[SelectOption]) -> Select classmethod

Create a Select object from the list of SelectOption's.

SelectTypeData

Type data for Select.

options: list[SelectOption] = Field(default_factory=list) class-attribute instance-attribute

SinglePropertyRelation

Defines a one-way relation configuration for a database property.

single_property: SinglePropertyRelationTypeData = Field(default_factory=SinglePropertyRelationTypeData) class-attribute instance-attribute

build_relation(dbref: UUID) -> Relation classmethod

Create a single_property relation using the target database reference.

dbref must be either a string or UUID.

SinglePropertyRelationTypeData

Type data for SinglePropertyRelation.

Status

Defines the status configuration for a database property.

status: StatusTypeData = Field(default_factory=StatusTypeData) class-attribute instance-attribute

build(options: list[SelectOption], groups: list[SelectGroup]) -> Status classmethod

Create a Status object from the list of SelectOption's.

Warning

While a Status property can be built, it can only be used to check a schema, not to create a database having such a property.

StatusTypeData

Type data for Status.

groups: list[SelectGroup] = Field(default_factory=list) class-attribute instance-attribute

options: list[SelectOption] = Field(default_factory=list) class-attribute instance-attribute

Title

Defines the title configuration for a database property.

title: TitleTypeData = Field(default_factory=TitleTypeData) class-attribute instance-attribute

TitleTypeData

Type data for Title.

URL

Defines the URL configuration for a database property.

url: URLTypeData = Field(default_factory=URLTypeData) class-attribute instance-attribute

URLTypeData

Type data for URL.

UniqueID

Unique ID database property.

unique_id: UniqueIDTypeData = Field(default_factory=UniqueIDTypeData) class-attribute instance-attribute

UniqueIDTypeData

Type data for UniqueID.

prefix: str | None = None class-attribute instance-attribute

Verification

Verfication database property of Wiki databases.

verification: VerificationTypeData = Field(default_factory=VerificationTypeData) class-attribute instance-attribute

VerificationTypeData

Type data for Verification.