Forum Discussion
AndrewRyder
6 years agoQrew Cadet
Hi,
Been using pyqb (https://github.com/sjmh/pyqb) for all of my python work w/the Quickbase API. It's not complete, but easy to fork and add to.
Been using pyqb (https://github.com/sjmh/pyqb) for all of my python work w/the Quickbase API. It's not complete, but easy to fork and add to.
- PushpakumarGna16 years agoQrew Assistant CaptainHi All,
Can you please let me know the steps to follow to extract data using python from quickbase
My ask is to create a python code that extracts the data from the report and save in the same location as csv file?
Can some one help me in this.
Thanks
Pushpakumar
------------------------------
Pushpakumar Gnanadurai
------------------------------- AustinK6 years agoQrew CommanderIf you follow the instructions listed in the link of the post you replied to you should be able to get to the point where you extract information from Quickbase. In the link it is the first 2 things listed. "Create the client" first and then you can do one of the things below that, DoQuery sounds like what you want. So set up your Python file as the link shows.
import pyqb # def Client(url="http://www.quickbase.com", database=None, proxy=None, user_token=None): qbc = pyqb.Client(url='http://my_domain.quickbase.com') # Below authenticate is not required if `user_token` argument is passed to pyqb.Client() above qbc.authenticate(username='myusername', password='mypassword')
If you need more context on what the "6".EX."myval" and other parts mean then the QuickBase api help docs should get you there. You can choose to grab a saved report or do your own query. https://help.quickbase.com/api-guide/do_query.html
# doquery(query=None, qid=None, qname=None, database=None, fields=None, fmt=False, rids=False, sort_fields=None, options=False): qbc.doquery(qid=64) qbc.doquery(query='{"6".EX."myval"}', database='asdfasdf') qbc.doquery(qid=64, fields=["3", "4"], fmt=True, rids=False)
Is there any specific part that you need help with? Some part you have attempted but not been able to get to work? Maybe post the code you have tried that failed and someone can help you fix it.
When you say you would like the code to extract the data and save it in the same place as the csv do you mean save to the same place your browser would save a csv if you clicked "Save as csv" on a report? Like your downloads folder? I assume you want the data to also be the same exact csv format as you would get from QuickBase? You may need to create the csv in code then, depending on what is returned via Python. I would assume you will get XML returned though.
The post below mine by David Choi is a great example of how to connect to QuickBase without using a library like the one above. So you are not limited to what the library can do, you can make whatever API call you need. It is more involved though and probably more difficult at times.- PushpakumarGna16 years agoQrew Assistant CaptainHi Austin,
Thanks a lot for the detailed description. I will try the code and let you know if i face any issues?
Thanks
------------------------------
Pushpakumar Gnanadurai
------------------------------