Alteryx not able to write from dataframe to SQL/excel

357 views Asked by At

I made an Alteryx workflow where I run code in a python notebook that pulls data from a web API, stores the output of the API pull as a dataframe and tries to write it to an excel file via anchor 1. I got the following error when I ran the workflow:

FileNotFoundError: Cached data unavailable -- run the workflow to make the input data available in Jupyter notebook (.\Alteryx_Automation\dsd_runner\jupyterPipes.json)

I'm very new to Alteryx and would appreciate any guidance/suggestions

Here is code that replicates the error and has similar structure to what I have in my notebook

``from ayx import Alteryx
class DataExtract():
    def __init__(self):
        self.url = 'https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv'
        self.data = dict()
def get_data(self):
    self.data['owid'] = pd.read_csv(self.url)

de = DataExtract()
de.get_data()
temp = de.data['owid']
Alteryx.write(temp,1)``
1

There are 1 answers

0
chronically_pythonic1 On BEST ANSWER

Solved the issue, I was issuing an os.chdir() command in the python notebook and my working directory was changed to a directory where i did not have write permission. Solved it by keeping track of current directory ( orig_dir = os.getcwd() ) and then issuing os.chdir(orig_dir) at the end of the script. Also, making a deep copy of the class attribute helped solve the issue as well.