Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pyatlan/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,13 @@ class ErrorCode(Enum):
"Use client.asset.set_dq_row_scope_filter_column() to configure the row scope filter column first.",
InvalidRequestError,
)
INVALID_RICH_TEXT_CREATION = (
400,
"ATLAN-PYTHON-400-076",
"Rich text attributes cannot be multi-valued for '{0}'.",
"Set multi_valued=False when creating rich text attributes.",
InvalidRequestError,
)
AUTHENTICATION_PASSTHROUGH = (
401,
"ATLAN-PYTHON-401-000",
Expand Down
1 change: 1 addition & 0 deletions pyatlan/model/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ class AtlanCustomAttributePrimitiveType(str, Enum):
URL = "url"
SQL = "SQL"
LONG = "long"
RICH_TEXT = "string"


class AtlanDeleteType(str, Enum):
Expand Down
26 changes: 26 additions & 0 deletions pyatlan/model/typedef.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,10 @@ class Options(AtlanObject):
"These cover any asset type that is not managed within a connection or a glossary. "
"Only assets of one of these types will have this attribute available.",
)
is_rich_text: Optional[bool] = Field(
default=False,
description="Whether this attribute supports rich text formatting (true) or not (false). ",
)

def __setattr__(self, name, value):
super().__setattr__(name, value)
Expand Down Expand Up @@ -579,6 +583,7 @@ def create(
multi_value_select=False,
show_in_overview=False,
is_enum=False,
is_rich_text=False,
)
if attribute_type in (
AtlanCustomAttributePrimitiveType.USERS,
Expand All @@ -590,6 +595,11 @@ def create(
elif attribute_type == AtlanCustomAttributePrimitiveType.OPTIONS:
options.is_enum = True
options.enum_type = options_name
elif attribute_type == AtlanCustomAttributePrimitiveType.RICH_TEXT:
# For RichText, we set the primitive type as string and enable rich text
options.is_rich_text = True
# Rich text attributes cannot be multi-valued
options.multi_value_select = False
return options

is_new: Optional[bool] = Field(
Expand Down Expand Up @@ -935,6 +945,14 @@ def create(
["display_name", "attribute_type"],
[display_name, attribute_type],
)
# RichText attributes cannot be multi-valued
if (
attribute_type == AtlanCustomAttributePrimitiveType.RICH_TEXT
and multi_valued
):
raise ErrorCode.INVALID_RICH_TEXT_CREATION.exception_with_parameters(
display_name
)
# Explicitly set all defaults to ensure inclusion during pydantic serialization
attr_def = AttributeDef(
display_name=display_name,
Expand Down Expand Up @@ -1035,6 +1053,14 @@ async def create_async(
["display_name", "attribute_type"],
[display_name, attribute_type],
)
# RichText attributes cannot be multi-valued
if (
attribute_type == AtlanCustomAttributePrimitiveType.RICH_TEXT
and multi_valued
):
raise ErrorCode.INVALID_RICH_TEXT_CREATION.exception_with_parameters(
display_name
)

# Async version of _get_all_qualified_names helper
async def _get_all_qualified_names_async(asset_type: str):
Expand Down
Loading