If the dataset do not exists, I either want to catch this exception thrown, or check if df exists

nc15apr
nc15apr Registered Posts: 2 ✭✭

Exception: Reading dataset failed: b"Failed to read data from table, caused by: SnowflakeSQLException: SQL compilation error:\nObject 'PROD_.GLOBAL_PILOT' does not exist or not authorized."

Tagged:

Answers

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,024 Neuron
    edited October 2

    You need to give more context than this. What are you trying to achieve? Post your Python recipe in a code block (the </> icon).

  • nc15apr
    nc15apr Registered Posts: 2 ✭✭

    In the community, you can ask the following question to address your requirement:

    "I would like to check if a dataframe exists before attempting to read a dataset. Furthermore, if the dataframe doesn't exist or if there are any issues in reading the dataset, I want to implement a condition to handle the error and perform a specific action. How can I achieve this in my code?"
    
     dataiku.Dataset("cn_pilot").get_dataframe()
    

    I would like to check if a dataframe exists before attempting to read a dataset. Furthermore, if the dataframe doesn't exist or if there are any issues in reading the dataset, I want to implement a condition to handle the error and perform a specific action. How can I achieve this in my code?

  • Turribeach
    Turribeach Dataiku DSS Core Designer, Neuron, Dataiku DSS Adv Designer, Registered, Neuron 2023 Posts: 2,024 Neuron
    try:
        dataiku.Dataset("cn_pilot").get_dataframe()
    except Exception as e:
        print(e)
    

Setup Info
    Tags
      Help me…