Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

[BUG]The scheduled refresh feature of the query is not working. #47

Open
Avey777 opened this issue Jun 9, 2023 · 11 comments
Open

[BUG]The scheduled refresh feature of the query is not working. #47

Avey777 opened this issue Jun 9, 2023 · 11 comments

Comments

@Avey777
Copy link

Avey777 commented Jun 9, 2023

Currently, the sharing page of Redash cannot refresh to load the latest data. It is hoped that this function can be added. Polling can be carried out when the page is refreshed or loaded.

Or the shared page may have data refresh settings.

image
image

@Avey777
Copy link
Author

Avey777 commented Jun 11, 2023

Or a feature could be provided to disable cache, so that the data is reloaded every time the user opens the page.

@Avey777
Copy link
Author

Avey777 commented Jun 11, 2023

I am currently refreshing data in batches using the method below, but it is very slow.

payload = {
  "parameters": {
    "DataSource": "us-one",
    "site": "us"
  },
  "max_age": 1
}
header = {
  "Authorization": "Key bF4R7JEgNU97J9YYl6dRLuBmERlhWbQuymGdNRX0",
  "content-type": "application/json"
} 

def refresh(payload,header):
    import requests
    try:
        sql = """select max(id) from queries"""
        count = execute_query("redash",sql)
        # print(count)
        vlaue = count['rows'][0]['max']
        print(vlaue)
        for id in range(vlaue):
            print(id)
            url = "http://127.0.0.1:5000/api/queries/"+str(id)+"/results"
            print("start")
            response = requests.request("POST", url, json=payload, headers=header)
            print("end")
            print(response.text)
       
    except:
        print('err2')
    rlt = {"columns": [{"name": "uname","type": "string","friendly_name": "uname"}],"rows": [{"uname": "test"}]}
    return rlt
 
        
result = refresh(payload,header)

@Avey777
Copy link
Author

Avey777 commented Jun 11, 2023

In fact, I am currently using the following Python code to periodically refresh data through Redash API.
refer to:

import requests

def refresh(url,payload,header):  
  try:   
    # url = "http://127.0.0.1:5500/api/queries/1/results"
    print("start")
    response = requests.request("POST", url, json=payload, headers=header)
    print("end")
    print(response.text)
    return response.text
  except:
    print('err')
    return 'err'

        
if __name__ == '__main__':
  # url = "https://redash.amiemall.com/api/queries/47/results"
  for site,country in [("mall","ghana"),("mall","ghanab2b"),("mall","viet nam b2b")]:
    payload = {
      "parameters": {
        "country": country,
        "site": site
      },
      "max_age": 1
    }
    header = {
      "Authorization": "Key bF4R7JEgNU97J9YYl6dRLuBmERlhWbQuymGdNRX0",
      "content-type": "application/json"
    } 
    for id in range(100):
      print(id)
      url = "http://192.210.197.70:5500/api/queries/"+str(id)+"/results"
      refresh(url,payload,header)
      print("Call completed.")




@Avey777 Avey777 changed the title Add polling function to the sharing page. The scheduled refresh feature of the query is not working. Jun 14, 2023
@Avey777 Avey777 changed the title The scheduled refresh feature of the query is not working. [BUG]The scheduled refresh feature of the query is not working. Jun 14, 2023
@gaecoli
Copy link
Member

gaecoli commented Jun 20, 2023

The same to #31

@gaecoli
Copy link
Member

gaecoli commented Jun 20, 2023

I don't know #61 maybe help you!

@Avey777
Copy link
Author

Avey777 commented Jun 20, 2023

I don't know #61 maybe help you!

Thank you, I will wait for the current docker image issue to be resolved, and then I will give it a try.

@Avey777
Copy link
Author

Avey777 commented Jun 20, 2023

@gaecoli
Due to certain network reasons (GFW), the Docker Hub is now banned. This makes it inconvenient for me to test Docker images. Can you take a look at this issue?

@justinclift
Copy link
Member

Oh wow. That sucks. If Docker Hub is permanently banned in China, that's going to be a problem for us (and others).

We can probably set up a mirror of our images somewhere. I have a few dedicated servers online with unmetered bandwidth (eg no download cost) for another project, so we could probably use one of those. It won't be a today thing though.

@gaecoli
Copy link
Member

gaecoli commented Jun 20, 2023

@gaecoli Due to certain network reasons (GFW), the Docker Hub is now banned. This makes it inconvenient for me to test Docker images. Can you take a look at this issue?

You can use proxy.

@Avey777
Copy link
Author

Avey777 commented Jun 21, 2023

image

@gaecoli
This hasn't completely solved my problem.

@gaecoli
Copy link
Member

gaecoli commented Jun 21, 2023

image

@gaecoli This hasn't completely solved my problem.

Maybe in query refresh schedule has problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants