Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 

 View Only
  • 1.  cognos Jupyter Notebook

    Posted Mon August 31, 2020 02:14 PM
    Hi,
    i am having some problems with Jupiter notebook and any help will be greatly apricated

    1) i am trying to read a query subject in Jupiter notebook .
    This Query subject exists in a package which I have published though framework manager 
    qryX = CADataConnector.read_data(path=".public_folders/Packages/Test DQM Package",query_subject = [exp['Query Subject'][0]])
    qryX
    when I retrieve the data in notebook, by default  I only get to see 10000 rows. But this query subject have  60000 rows. why am I not able to retrieve all the data from this query subject.?
    I also tried to force pd.set_option('display.max_rows', 60000) but even though i can not retrieve more then 10000 rows. 

    2) when ever I run Jupiter notebook it looks like it randomly picks the 10000 records and shows me different data set every time i run.

    3) I am not able to write notebook  back to Cognos . I am getting a error 
    Error details:
    ---------------------------------------------
    {"msg":"CM-REQ-4335 An error occurred while updating the object 'storeID(\"i7345FE0C93EF4732A4E16C5FAE5A409B\")'.","code":"CM-REQ-4335"}

    try:
    CADataConnector.write_data(qryX, path=".public_folders/Test", mode="w")
    except Exception as e:
    print(e)

    Can some one please help me. Thanks.

    Regards,
    Pradeep Sahay 



    ------------------------------
    pradeep sahay
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: cognos Jupyter Notebook

    Posted Tue December 05, 2023 09:39 AM
    Edited by Thomas Strehl Tue December 05, 2023 09:39 AM

    You can use specifiy cols and rows to read like this: 

    useCols=['col1','col2', ...,'coln']
    df = CADataConnector.read_data(path="........../.../file.csv",  nrows=1E6,   usecols=useCols)



    ------------------------------
    Thomas Strehl
    ------------------------------



  • 3.  RE: cognos Jupyter Notebook

    Posted Wed December 06, 2023 10:26 AM
    Edited by Jim Boland Wed December 06, 2023 05:12 PM

    Yes,  as @Thomas Strehl described perfectly, you can use the nrows parameter in the CADataConnector.read_data call to specify the maximum number of rows that the call will return (otherwise the default is 10,000). As well, if your dataset is too large to load it all up at once in your notebook, you can also use the chunksize/iterator parameters in this call to fetch the data in smaller "chunks" , and iterate over the dataset content, processing each window of data, one at a time.

    Full documentation on the read_data parameters is here

    For your other problem ("I am not able to write notebook  back to Cognos . I am getting a error"), it sounds like from your description you are trying to write the notebook back to CA content store using: CADataConnector.write_data? This won't work as the CADataConnector.write_data() method is for writing pandas tables back into the CA content as data sources (not for writing your notebook back).  To save/update your notebook back into the CA content, click on the "Save" icon in the CA Jupyter notebook UI (described here).



    ------------------------------
    Jim Boland

    LinkedIn: https://www.linkedin.com/in/jimboland
    Website: https://coreinsightz.com
    Email: jimboland@coreinsightz.com
    ------------------------------