Issue
I have following dict, where Incoming Inspection Report
is the table name.
querystring = {"q":"Select * from \"Incoming Inspection Report\"","format":"json","headers":"true","metadata":"true","arrays":"false","page":"1","per_page":"20000"}
how can I construct the querystring
dynamically for multiple tables ?
I tried .format
string,
table_name = 'Incoming Inspection Report'
querystring = '{"q":"Select * from \"{table}\"","format":"json","headers":"true","metadata":"true","arrays":"false","page":"1","per_page":"20000"}'.format(table=table_name)
but didn't work.
Solution
Have you tried using f-strings?
table_name_1 = 'Incoming Inspection Report'
querystring1 = {"q":f"Select * from \"{table_name_1}\"","format":"json","headers":"true","metadata":"true","arrays":"false","page":"1","per_page":"20000"}
table_name_2 = 'Table name 2'
querystring2 = {"q":f"Select * from \"{table_name_2}\"","format":"json","headers":"true","metadata":"true","arrays":"false","page":"1","per_page":"20000"}
Answered By - Ricardo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.