Tabular row
class TabularRow
Represents a single row in a tabular attribute. Provides access to the cells in the row, as well as the linking value and identifier of the row.Notes
Do not create instances of this class. UseAttributeTabular.rows to access existing rows and
AttributeTabular.append_row() to create new rows.
set_linking_value(value)
Sets the linking value of the row. Set toNone to clear the linking value. The row will no longer be linked to any records.
- Parameters: value (str or None) – The new linking value for the row.
- Raises:
ValueError – If
is_exportedisTrueand destructive editing is not enabled.
SEE ALSO
AttributeTabular.is_destructive_editing_allowed
: Whether destructive editing of the tabular attribute value is allowed.
property cells : tuple[TabularCell | tuple[TabularCell, …], …]
The cells in the row.- Return type: tuple[TabularCell]
property cells_by_column : Mapping[str, TabularCell | tuple[TabularCell, …]]
The cells in the row, indexed by the column name.- Returns: Mapping of column name to TabularCell.
- Return type: Mapping[str, TabularCell]
property identity : int
The identity of the row.- Return type: int
property is_exported : bool
Whether the row represents an existing row in the database.- Return type: bool
property linking_value : str | None
The linking value of the row.- Return type: str or None
Linked tabular cells
class TabularCell
Abstract base class for tabular cell value types. Extended byEditableTabularCell.
See the following concrete implementations:
ShortTextValueLongTextValueLogicalValueIntegerValueDateValuePointValueRangeValueHyperlinkValueDiscreteValuePictureValueFileValueIgnoredLocalTabularCellUnavailableTabularCell
class ShortTextValue
Represents a single short text value in a linked short text tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : str | None
Text value associated with this tabular cell.- Return type: str or None
class LongTextValue
Represents a single long text value in a linked long text tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : str | None
Text value associated with this tabular cell.- Return type: str or None
class LogicalValue
Represents a single logical value in a linked logical tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : bool | None
Logical value associated with this tabular cell.- Return type: bool or None
class IntegerValue
Represents a single integer value in a linked integer tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : int | None
Integer value associated with this cell.- Return type: int or None
class DateValue
Represents a single date value in a linked date tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : date | None
Date value associated with this tabular cell.- Return type:
datetime.dateor None
class PictureValue
Represents a picture value in a linked picture tabular cell.Notes
Tabular Picture Cells only support a single binary data value, together with an optional URL and MIME file type. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
save(path)
Save binary data to disk.- Parameters: path (str or pathlib.Path) – File path where the binary data will be saved.
- Raises:
- TypeError – If path is not a string or pathlib.Path.
- AssertionError – If the value is empty.
property binary_data : bytes | None
Binary data associated with this tabular cell.- Return type: bytes or None
- Raises: UnexportedBinaryDataError – If binary data is available on the server but was not exported.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property mime_file_type : str | None
MIME (Multipurpose Internet Mail Extensions) file type.- Return type: str or None
property url : str | None
URL associated with this tabular cell. In a future version this property will raise an exception if the attribute is exported withinclude_binary_data = True. See Planned file and picture data changes for more details.
- Return type: str or None
property value : bytes | None
Binary data if present. In a future version this property will return the URL if the attribute is exported withinclude_binary_data = False. See Planned file and picture data changes for more details.
- Return type: bytes or None
class FileValue
Represents a file data value in a linked file tabular cell.Notes
Tabular File Cells support a single binary data value and a file name, together with an optional description, URL, and MIME file type. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
save(path)
Save binary data to disk.- Parameters: path (str or pathlib.Path) – File path where the binary data will be saved.
- Raises:
- TypeError – If path is not a string or pathlib.Path.
- AssertionError – If the value is empty.
property binary_data : bytes | None
Binary data associated with this tabular cell.- Return type: bytes or None
- Raises: UnexportedBinaryDataError – If binary data is available on the server but was not exported.
property description : str | None
Description of the file.- Return type: str or None
property file_name : str | None
Name of the file, including the file extension.- Return type: str or None
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property mime_file_type : str | None
MIME (Multipurpose Internet Mail Extensions) file type.- Return type: str or None
property url : str | None
URL associated with this tabular cell. In a future version this property will raise an exception if the attribute is exported withinclude_binary_data = True. See Planned file and picture data changes for more details.
- Return type: str or None
property value : bytes | None
Binary data if present. In a future version this property will return the URL if the attribute is exported withinclude_binary_data = False. See Planned file and picture data changes for more details.
- Return type: bytes or None
class PointValue
Represents a single point value in a linked point tabular cell.Notes
Tabular Point Cells only support a single value and an optional unit. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property unit : str | None
Unit symbol of the tabular cell.property value : int | float | None
Point value associated with this cell.- Return type: float or None
class RangeValue
Represents a range value in a linked range tabular cell.Notes
Tabular Range Cells support a low and high value, both of which can be inclusive or exclusive, together with an optional unit. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
property high : float | None
High value of the range.- Return type: float or None
property high_value_is_inclusive : bool
Whether the high value is included in the range.- Return type: bool
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property low : float | None
Low value of the range.- Return type: float or None
property low_value_is_inclusive : bool
Whether the low value is included in the range.- Return type: bool
property unit : str | None
Unit symbol of the tabular cell.class DiscreteValue
Represents a single discrete value in a linked discrete tabular cell.Notes
Tabular Discrete Cells only support a single value and an order, which is the index of the value in the list of possible discrete values for the column. This does not imply that the associated discrete type is ordered. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property order : int | None
Position of the current discrete value in the discrete type.- Returns: Position (1-indexed) in the discrete type. Relevant for ordered discrete types only.
- Return type: int or None
property value : str | None
Discrete value associated with this tabular cell.- Return type: str or None
class HyperlinkValue
Represents a hyperlink value in a linked hyperlink tabular cell.Notes
Tabular Hyperlink Cells support a value, a display type, and a description. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
property hyperlink_description : str | None
Text which displays instead of the URL in MI applications.- Return type: str or None
property hyperlink_display : str | None
How the hyperlink should be opened in MI applications. Takes one of the following values:-
New: Open in a new window or tab. -
Top: Open in the current window or tab. -
Content: Open within the current MI application (for example, in a frame or dialog). - Return type: str or None
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : str | None
URL of the hyperlink.- Return type: str or None
Local tabular cells
class EditableTabularCell
Abstract base class for editable tabular cell value types. See the following concrete implementations:LocalShortTextValueLocalLongTextValueLocalLogicalValueLocalIntegerValueLocalDateValueLocalPointValueLocalRangeValueLocalHyperlinkValueLocalDiscreteValueLocalPictureValueLocalFileValue
class LocalShortTextValue
Represents a single short text value in a local short text tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thevalue property.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : str | None
Text value associated with this tabular cell.- Return type: str or None
class LocalLongTextValue
Represents a single long text value in a local long text tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thevalue property.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : str | None
Text value associated with this tabular cell.- Return type: str or None
class LocalLogicalValue
Represents a single logical value in a local logical tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thevalue property.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : bool | None
Logical value associated with this tabular cell.- Return type: bool or None
class LocalIntegerValue
Represents a single integer value in a local integer tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thevalue property.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : int | None
Integer value associated with this cell.- Return type: int or None
class LocalDateValue
Represents a single date value in a local date tabular cell.Notes
Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thevalue property.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : date | None
Date value associated with this tabular cell.- Return type:
datetime.dateor None
class LocalPictureValue
Represents a picture value in a local picture tabular cell.Notes
Tabular Picture Cells only support a single binary data value, together with an optional URL and MIME file type. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thebinary_data, url, and mime_file_type properties.
load(path)
Load an image file into this PictureValue object.- Parameters:
path (pathlib.Path or str) – Path to the image file to load. Relative paths are permitted. Takes the form
C:\Users\username\Pictures\image.jpgor/home/username/Pictures/image.jpg. - Raises: TypeError – If path is not a pathlib.Path or string.
save(path)
Save binary data to disk.- Parameters: path (str or pathlib.Path) – File path where the binary data will be saved.
- Raises:
- TypeError – If path is not a string or pathlib.Path.
- AssertionError – If the value is empty.
property binary_data : bytes | None
Binary data associated with this tabular cell.- Return type: bytes or None
- Raises: UnexportedBinaryDataError – If binary data is available on the server but was not exported.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property mime_file_type : str | None
MIME (Multipurpose Internet Mail Extensions) file type. If this object is populated via export, themime_file_type property returns the MIME file type stored in
Granta MI.
If this object is populated via load(), or setting binary_data or value, the
mime_file_type property is populated using the filetype library. If filetype cannot determine the
MIME file type, the mime_file_type property is set to None and Granta MI determines the MIME file
type during import.
- Return type: str or None
Notes
The filetype PyPI page lists supported MIME types.property url : str | None
URL associated with this tabular cell. In a future version this property will raise an exception if the attribute is exported withinclude_binary_data = True. See Planned file and picture data changes for more details.
- Return type: str or None
property value : bytes | None
Binary data if present. In a future version this property will return the URL if the attribute is exported withinclude_binary_data = False. See Planned file and picture data changes for more details.
- Return type: bytes or None
class LocalFileValue
Represents a file data value in a local tabular cell.Notes
Tabular File Cells support a single binary data value and a file name, together with an optional description, URL, and MIME file type. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thebinary_data, url, mime_file_type, file_name, and description properties.
load(path)
Load a file into this FileValue object.- Parameters:
path (pathlib.Path or str) – Path to the file to load. Relative paths are permitted. Takes the form
C:\Users\username\Documents\file.pdfor/home/username/Documents/file.pdf. - Raises: TypeError – If path is not a pathlib.Path or string.
save(path)
Save binary data to disk.- Parameters: path (str or pathlib.Path) – File path where the binary data will be saved.
- Raises:
- TypeError – If path is not a string or pathlib.Path.
- AssertionError – If the value is empty.
property binary_data : bytes | None
Binary data associated with this tabular cell.- Return type: bytes or None
- Raises: UnexportedBinaryDataError – If binary data is available on the server but was not exported.
property description : str | None
Description of the file.- Return type: str or None
property file_name : str | None
Name of the file, including the file extension.- Return type: str or None
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property mime_file_type : str | None
MIME (Multipurpose Internet Mail Extensions) file type. If this object is populated via export, themime_file_type property returns the MIME file type stored in
Granta MI.
If this object is populated via load(), or setting binary_data or value, the
mime_file_type property is populated using the filetype library. If filetype cannot determine the
MIME file type, the mime_file_type property is set to None and Granta MI determines the MIME file
type during import.
- Return type: str or None
Notes
The filetype PyPI page lists supported MIME types.property url : str | None
URL associated with this tabular cell. In a future version this property will raise an exception if the attribute is exported withinclude_binary_data = True. See Planned file and picture data changes for more details.
- Return type: str or None
property value : bytes | None
Binary data if present. In a future version this property will return the URL if the attribute is exported withinclude_binary_data = False. See Planned file and picture data changes for more details.
- Return type: bytes or None
class LocalPointValue
Represents a single point value in a local point tabular cell.Notes
Tabular Point Cells only support a single value and an optional unit. This class also exposes the default unit based on the column definition. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thevalue property.
Revert the unit property its default value.
property default_unit : str | None
Default unit symbol of the tabular cell.- Returns:
Default unit symbol as defined by the column, or
Noneif the column is dimensionless. - Return type: str or None
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property unit : str | None
Unit symbol of the tabular cell.property value : int | float | None
Point value associated with this cell.- Return type: float or None
class LocalRangeValue
Represents a range value in a local range tabular cell.Notes
Tabular Range Cells support a low and high value, both of which can be inclusive or exclusive, together with an optional unit. This class also exposes the default unit based on the column definition. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thelow and high properties.
Revert low_value_is_inclusive, high_value_is_inclusive, and unit properties to their default values.
property default_unit : str | None
Default unit symbol of the tabular cell.- Returns:
Default unit symbol as defined on the column, or
Noneif the column is dimensionless. - Return type: str or None
property high : float | None
High value of the range.- Return type: float or None
property high_value_is_inclusive : bool
Whether the high value is included in the range.- Return type: bool
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property low : float | None
Low value of the range.- Return type: float or None
property low_value_is_inclusive : bool
Whether the low value is included in the range.- Return type: bool
property unit : str | None
Unit symbol of the tabular cell.class LocalDiscreteValue
Represents a single discrete value in a local discrete tabular cell.Notes
Tabular Discrete Cells only support a single value and an order, which is the index of the value in the list of possible discrete values for the column. This does not imply that the associated discrete type is ordered. This class also exposes the possible discrete values based on the column definition. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thevalue property.
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property order : int | None
Position of the current discrete value in the discrete type.- Returns: Position (1-indexed) in the discrete type. Relevant for ordered discrete types only.
- Return type: int or None
property possible_discrete_values : FrozenSet[str]
Set of the tabular cell’s possible discrete data values.- Return type: FrozenSet[str]
property value : str | None
Discrete value associated with this tabular cell.- Return type: str or None
class LocalHyperlinkValue
Represents a hyperlink value in a local hyperlink tabular cell.Notes
Tabular Hyperlink Cells support a value, a display text, and a description. Do not create instances of this class; it represents a pre-existing database structure. UseTabularRow.cells or TabularRow.cells_by_column to access an instance of this class.
clear()
Clear thevalue, hyperlink_display, and hyperlink_description properties.
property hyperlink_description : str | None
Text which displays instead of the URL in MI applications.- Return type: str or None
property hyperlink_display : str | None
How the hyperlink should be opened in MI applications. Takes one of the following values:-
New: Open in a new window or tab. -
Top: Open in the current window or tab. -
Content: Open within the current MI application (for example, in a frame or dialog). - Return type: str or None
property is_empty : bool
Whether the tabular cell is populated or not.- Return type: bool
property value : str | None
URL of the hyperlink.- Return type: str or None
Miscellaneous tabular cells
class IgnoredLocalTabularCell
Represents a tabular cell that has been marked as ignored.Notes
Do not create instances of this class; it represents a pre-existing database structure. Instances of this class are returned byTabularRow.cells or TabularRow.cells_by_column for ignored local columns.
SEE ALSO
AttributeDefinitionTabular.columns_to_process
: Specify ignored columns before data export.
class UnavailableTabularCell
Represents a cell that was not available for export.Notes
This cell type is used when the presence of data could not be determined definitively, for example due to a missing target database. Do not create instances of this class; it represents a pre-existing database structure. Instances of this class are returned byTabularRow.cells or TabularRow.cells_by_column for unavailable columns.