domoinc / domo-python-sdk

Python3 - Domo API SDK
https://developer.domo.com/
MIT License
114 stars 75 forks source link

TypeError when trying to export Dataset #69

Open Justinbenfit23 opened 3 years ago

Justinbenfit23 commented 3 years ago

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? 
jeremydmorris commented 3 years ago

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.