betodealmeida / shillelagh

Making it easy to query APIs via SQL
MIT License
387 stars 52 forks source link

Shillelagh caching headers #454

Closed thomas-michels closed 2 months ago

thomas-michels commented 4 months ago

Describe the bug I tryed to make some requests inside Superset using Shillelagh like that.

SELECT * FROM "http://localhost:8000/v1/area_types?_s_headers=(x-token:token1)#$.data[*]"

x-token can vary between clients and something is caching them, the cache duration is almost 3 minutes. There's anything that I can configure to stop caching headers?

Superset 3.1 Shillelagh 1.2.15

betodealmeida commented 3 months ago

Right now there's no way to set it. Let me add a parameter to overwrite that.

betodealmeida commented 3 months ago

@thomas-michels actually, it looks like there is a way! 😄

You should be able to set the cache_expiration expiration when configuring the connection. In Superset put this in your database configuration, under "Advanced" -> "Other":

{
  "connect_args": {
    "adapters": [
      "genericjsonapi"
    ],
    "adapter_kwargs": {
      "genericjsonapi": {
        "cache_expiration": 0
      }
    }
  }
}

connection = connect(

betodealmeida commented 3 months ago

Let me know if this works for you!

betodealmeida commented 2 months ago

@thomas-michels I'm going to close the issue, feel free to reopen if the solution above doesn't work for you.