Skip to content

Commit

Permalink
[CORE-5238] Use string for database endpoint params
Browse files Browse the repository at this point in the history
Followup to #8. JSON encoding the params resulted in URL encoded JSON
object in query string sent to the Metabase API.

The requests package expects a dictionary of strings for `params` [1]
with no rules to encode boolean types [2, 3], so best to keep it simple
and use strings.

[1]: https://docs.python-requests.org/en/latest/user/quickstart/#passing-parameters-in-urls
[2]: psf/requests#2999
[3]: psf/requests#3355
  • Loading branch information
cappadona committed Jan 30, 2024
1 parent 05b3234 commit 5927d76
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion intake_metabase/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def get_databases(self):
self._create_or_refresh_token()

headers = _merge_dicts({'X-Metabase-Session': self._token}, self.extra_headers)
params = json.dumps({'include': 'tables', 'saved': True})
params = {'include': 'tables', 'saved': 'true'}

res = requests.get(
urljoin(self.domain, '/api/database'),
Expand Down

0 comments on commit 5927d76

Please # to comment.