Using Python API to Update Already Created Datasets
Hi Everyone,
I am trying to find a way to upload information from a python script into a domo dataset weekly. I am finding that you can't update an existing dataset with this method, only create a new one and update that newly created one. Has anyone found a workaround for this? In the documentation it appears this is correct but it feels like this would be a necessary part of the API. The process would look something like, python runs a process to obtain a new pandas df. This df then needs to be loaded into an existing domo dataset. When I try using ds_update on a dataset that has already been created, I get a "Error retrieving DataSet: {"status":403,"statusReason":"Forbidden","message":"Access is denied"
Here is the documentation where it says, 'ds_update - updates an existing data set, only data sets created by the API can be updated'
Any help would be awesome, thanks! I'd rather not post this to SQL, then ingest from SQL to DOMO (no need to add steps if there is an API..)
Best Answers
-
@ElliotGitter where is your dataset coming from? Is it updating from somewhere else too?
Once you've created the dataset using the API, you can always update it using the API (it's not like everytime you run your python script you have to create a new dataset to update). If you can create a new dataset using the API, update it once with the data in yourcurrent dataset, then moving forward you can update that dataset you created with your python script.
2 -
Hi @mhouston ,
I just figured it out. I was using the ds_update() function with a variable that had already called the ID which may have been messing with the update. Here is the test case I was running before creating it for my use case.
Here is the old way which was giving me the 403 error:
testdata = domo.ds_get('myid')
test2 = testdata.append(testdata).reset_index(drop=True)
update = domo.ds_update(testdata, test2)
Here is the new way (call the Dataset ID in the function instead of a variable that is holding the ID):
update = domo.ds_update('myid', test2)
0 -
@ElliotGitter it looks like in your old way you weren't actually using the id in your ds_update function - reading your code it looks like testdata is a dataframe (ds_get returns a dataframe, not an id), and that's why you were getting an error.
1
Answers
-
@ElliotGitter where is your dataset coming from? Is it updating from somewhere else too?
Once you've created the dataset using the API, you can always update it using the API (it's not like everytime you run your python script you have to create a new dataset to update). If you can create a new dataset using the API, update it once with the data in yourcurrent dataset, then moving forward you can update that dataset you created with your python script.
2 -
Hi @mhouston ,
I just figured it out. I was using the ds_update() function with a variable that had already called the ID which may have been messing with the update. Here is the test case I was running before creating it for my use case.
Here is the old way which was giving me the 403 error:
testdata = domo.ds_get('myid')
test2 = testdata.append(testdata).reset_index(drop=True)
update = domo.ds_update(testdata, test2)
Here is the new way (call the Dataset ID in the function instead of a variable that is holding the ID):
update = domo.ds_update('myid', test2)
0 -
@ElliotGitter it looks like in your old way you weren't actually using the id in your ds_update function - reading your code it looks like testdata is a dataframe (ds_get returns a dataframe, not an id), and that's why you were getting an error.
1 -
Anyway that we could update the name and descriptions of the existing dataset? I checked that ds_rename and ds_import are not available now. Thanks.
0
Categories
- All Categories
- 1.8K Product Ideas
- 1.8K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 737 Beast Mode
- 55 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive