Giter Club home page Giter Club logo

redash-api-client's People

Contributors

damienzeng73 avatar nico722 avatar tamsanh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

redash-api-client's Issues

Using kwargs in create_XX functions to allow passing any parameters in the payload

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.

x and y axis error with some type of visualization

When using create_visualizations() with some kind of visualizations type (eg: counter, funnel, etc), the API gives errors regarding x and y axis, even when they are not supposed to be given for that kind of visualizations.

issue in fetching data in python - Status error: 2

Hi,
I am using Redash.generate_query_result to fetch data from Redash.
It behaves randomly that sometimes it gets the result and sometimes throws an error with Status: 2. Attaching screenshot.

image

The same query runs in Redash successfully hence, no issues with server.

Currently using Python's Try, Exception to complete the job, but it sometimes take forever to execute.
Is it a known issue? What can be the possible reasons for it and what can be the solution?

Query not running when changing dates

Hey,

is there any max payload that someone can retrieve using the API you have created?
I have been using the library and have the following issue:

We define a start_date and an end_date:

  • start = convert_str_datetime_to_utc("2022-05-01 00:00:00")
  • end = convert_str_datetime_to_utc("2022-12-01 23:59:59")

The weird thing is that the query runs ok when the start_date is 2022-06-01 00:00:00 but when the start_date is 2022-05-01 00:00:00 the response you get is the following:

File ~/miniconda3/envs/opap-kpis/lib/python3.9/site-packages/redashAPI/client.py:125, in RedashAPIClient.query_and_wait_result(self, ds_id, query, timeout)
121 raise Exception('Polling timeout.')
123 time.sleep(0.2)
--> 125 return self.get(f'query_results/{query_result_id}')

File ~/miniconda3/envs/opap-kpis/lib/python3.9/site-packages/redashAPI/client.py:18, in RedashAPIClient.get(self, uri)
15 res = self.s.get(f"{self.host}/api/{uri}")
17 if res.status_code != 200:
---> 18 raise Exception(f"[GET] /api/{uri} ({res.status_code})")
20 return res

Exception: [GET] /api/query_results/2196159 (502)

Also I have noticed the same behaviour when adding some columns to a query that is running ok.

I was thinking that this is due to a max payload or a maximum number of lines the redash_api can fetch.

I should also mention here that the query is running on the redash client we have set up on a Kubernetes cluster.

Could you please look into this?

Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.