Jump to content

Can assets in a tree have additional properties associated with them?


Ben Hines
Go to solution Solved by John Brezovec,

Recommended Posts

I'm adding assets to a tree using the spy.assets.Tree.insert method and passing  a dataframe with columns "Name", "Type", and "Path".  This works perfectly and I can build/update the tree nicely.  I added some columns to the dataframe thinking that these would become visible as properites in the info view for each asset in Workbench.  However, I'm not seeing these.  Do assets not support additional properties?  

Link to comment
Share on other sites

  • 2 weeks later...
  • Seeq Team
  • Solution

Inserting arbitrary properties is not currently supported when using SPy Trees. If you're using SPy Trees to quickly build trees using existing items, one alternative is to push asset tree metadata directly using spy.push. If you supply Path/Asset columns in your metadata DataFrame, SPy will place the generated items in the specified locations, generating assets when needed. When taking this approach, arbitrary properties can be specified. Here's a quick example that will run on any Seeq instance:

# search for items to put in tree
items_for_tree = spy.search(
    {"Path": "Example >> Cooling Tower 1 >> Area G", "Datasource Name": "Example Data"}
)
items_for_tree["Reference"] = True # tell spy to generate references to this item, rather than modifying the item itself
items_for_tree["Arbitrary Property"] = "Trumpet" # add arbitrary property
columns_to_push = [ # only include the minimum necessary properties
    "ID",
    "Path",
    "Asset",
    "Name",
    "Type",
    "Reference",
    "Arbitrary Property",
]
metadata = items_for_tree[columns_to_push]
spy.push(metadata=metadata, workbook="Push Tree Directly") # push that tree!

Note the use of the Reference column, which tells SPy to generate a reference to the item specified in the ID column.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...