iode.Scalars.is_detached
- property Scalars.is_detached: bool
Whether or not any change made on the present database or subset will modify the global IODE workspace.
- Returns:
- bool
Examples
>>> from iode import SAMPLE_DATA_DIR >>> from iode import comments >>> comments.load(f"{SAMPLE_DATA_DIR}/fun.cmt") Loading .../fun.cmt 317 objects loaded >>> # 'comments' represents the global Comments workspace >>> comments.is_detached False >>> comments["ACAF"] 'Ondernemingen: ontvangen kapitaaloverdrachten.'
>>> # by default, making a selection will create a new database >>> # object that is a 'view' of the global Comments workspace. >>> # Any change made on this 'view' (subset) will also modify >>> # the global workspace. >>> cmt_subset = comments["A*"] >>> cmt_subset.is_detached False >>> cmt_subset["ACAF"] = "modified comment" >>> cmt_subset["ACAF"] 'modified comment' >>> comments["ACAF"] 'modified comment' >>> # adding a new comment to the subset will also add it >>> # to the global workspace >>> cmt_subset["NEW_CMT"] = "new comment" >>> "NEW_CMT" in comments True >>> comments["NEW_CMT"] 'new comment' >>> # removing a comment from the subset will also remove it >>> # from the global workspace >>> del cmt_subset["NEW_CMT"] >>> "NEW_CMT" in comments False
>>> # explicitly calling the copy method will create a new >>> # detached database. Any change made on the copy will not >>> # modify the global workspace. >>> cmt_copy = comments["A*"].copy() >>> cmt_copy.is_detached True >>> cmt_copy["AOUC"] = "modified comment" >>> cmt_copy["AOUC"] 'modified comment' >>> comments["AOUC"] 'Kost per eenheid produkt.'