Skip to main content
Solved

List Model Views function fails in Streamlit app

  • 23 July 2024
  • 3 replies
  • 18 views

Hello Team,

 

I am trying to list views available in my model, using the function

pdmViewList = client.data_modeling.views.list(space= pdmSpace,all_versions=False, limit=-1)

This runs successfully in Jupyter notebook when I test it, but fails in Streamlit app, I am unable to figure out the reason. Can someone help if I am missing out on anything here?

Below is my code snippet from my app:

import streamlit as st
import pandas as pd
from streamlit.components.v1 import html
from cognite.client import CogniteClient
from MyLibrary import get_pdm_facet
from cognite.client.data_classes.filters import (
Equals,
And,
In,
FilterValueList,
Or,
Prefix
)
from cognite.client.data_classes.data_modeling import (
NodeApply, # node constructor
ViewId, # view reference
DirectRelationReference,
SingleHopConnectionDefinition,
NodeOrEdgeData,
NodeId,
InstancesDeleteResult

)
client = CogniteClient()

# PDM Model Details
pdmModelExternalId = "production_domain_model"
pdmSpace = "slb-pdm-dm-governed"
instanceSpaceGoverned = "slb-pdm-di-governed"
instanceSpaceShared = "slb-pdm-di-shared"
customerSpace = "slb-shaya-di-governed"
pdmModelVersion = "2_0"


pdmViewList = client.data_modeling.views.list(space= pdmSpace,all_versions=False, limit=-1)

st.write(pdmViewList)

 

this is the error that I am receiving

 

 

below is the screenshot when I tried to run in Jupyter notebook

 

3 replies

Userlevel 2
Badge +3

Exactly same code works in a different CDF project - 

 

 

Userlevel 3

Hi @Hassan Gomaa Would you be able to help resolve this?



 

Userlevel 4
Badge +2

Hi @HanishSharma,

I hope the issue is resolved. I’m closing this topic for now. Feel free to start a new post if you have any questions. 

Reply