domo-python-sdk icon indicating copy to clipboard operation
domo-python-sdk copied to clipboard

TypeError when trying to export Dataset

Open Justinbenfit23 opened this issue 3 years ago • 1 comments

I am trying to export a dataset from my company's Domo instance and am getting the following error when trying to run the following code (I have removed the actual client_id, client_secret, and data_set_id:

import pandas as pd
domo = Domo('client_id','client_secret', api_host='api.domo.com')
domo.ds_get('data_set_id')```

results in `TypeError: <class 'bool'> is not convertible to datetime`

I checked the github and it looks like the function definition for the ds_get function attempts the following on each column of the dataset:

`for col in df.columns:
            if df[col].dtype == 'object':
                try:
                    df[col] = to_datetime(df[col])
                except ValueError:
                    pass`
This seems to be where I am getting the TypeError which appears to be failing because this try-except block looks to only handle ValueErrors. Is there any way to get around this? 

Justinbenfit23 avatar Oct 30 '21 03:10 Justinbenfit23

The solution is to add an exception for TypeError. I just pushed the ds-upsert branch that includes this fix. Can you try it out and see if it works? I'll publish to pip in the next few days.

jeremydmorris avatar Nov 03 '21 22:11 jeremydmorris