-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
For example, for create_query:
It is probably good that the payload always contains a few parameters (e.g., data_source_id, name, etc...), but what about all other potential (and useful) parameters? For example tags, etc, Using kwargs would be a great way to make your API much more general.
For example for create_query:
def create_query(self, ds_id: int, name: str, qry: str, desc: str="", with_results: bool=True, **kwargs):
payload = {
"data_source_id": ds_id,
"name": name,
"query": qry,
"description": desc,
**kwargs
}
res = self.post('queries', payload)
if with_results:
self.generate_query_results(ds_id, qry)
return res
Then you can use it with
redash.create_query(1, "my query", "select 1 from table", "description", with_results=False, tags=["mytag"], options={} )
If you remove options (i would) that would be a breaking change, so that's probably your decision.
But all that would be very easy to add that to all create_XXX functions.
Metadata
Metadata
Assignees
Labels
No labels