Error creating query using python and pydomo
Hello,
When attempting to query a dataset with a simple query
query = {"sql": "SELECT * FROM table"}
I get this exception
Exception: Error creating query: {"status":400,"statusReason":"Bad Request","message":"Cannot deserialize instance of `java.lang.String` out of START_OBJECT token"
Using domo.ds_meta and domo.ds_get work fine, but I need to be able to query a larger dataset.
Thank for any help you can offer!
Best Answers
-
Hi @taylordomo
Do you have any extra code / context for how you're calling ds_query?
Are you passing your dictionary as the query or just the query string? Looking at the code for the query function it looks like it does the packaging automatically for you so you shouldn't need to pass in {"sql": "select * from table"} but rather just pass in your query itself "select * from table"
**Was this post helpful? Click Agree or Like below**
**Did this solve your problem? Accept it as a solution!**0 -
Yes! Changing the query to a string worked. Now that I look around, I am not sure where I got the idea that I needed a dictionary. For others that have this same issue:
query = "SELECT * FROM table"
df = domo.ds_query(dataset_id=dataset_id, query=query, return_data=True)
Is the correct code to get the querying to work. Query needs to be a string, not a dictionary.
Appreciate the help!
0
Answers
-
what happens when you don't use SELECT * and actually select column names?
Jae Wilson
Check out my 🎥 Domo Training YouTube Channel 👨💻
**Say "Thanks" by clicking the ❤️ in the post that helped you.
**Please mark the post that solves your problem by clicking on "Accept as Solution"0 -
Hey, I appreciate the idea! I'm getting the same exception with any of these:
{"sql": "SELECT name, id FROM table"}
{"sql": "SELECT name, id FROM table Limit 3"}
0
Categories
- 11K All Categories
- 5 Private Company Board
- 2 APAC User Group
- 12 Welcome
- 42 Domo News
- 9.9K Using Domo
- 2K Dataflows
- 2.5K Card Building
- 2.2K Ideas Exchange
- 1.2K Connectors
- 349 Workbench
- 267 Domo Best Practices
- 11 Domo Certification
- 474 Domo Developer
- 51 Domo Everywhere
- 110 Apps
- 725 New to Domo
- 85 Dojo
- Domopalooza
- 1.1K 日本支部
- 4 道場-日本支部へようこそ
- 29 お知らせ
- 65 Kowaza
- 301 仲間に相談
- 662 ひらめき共有