vvaezian / metabase_api_python

A python wrapper for Metabase API
MIT License
136 stars 40 forks source link

Unable to use get_columns_name_id as a non-superuser #31

Closed jasjuang closed 2 years ago

jasjuang commented 2 years ago

In the get_columns_name_id function, it checks friendly_names_is_disabled first before allowing us to use the function as seen in https://github.com/vvaezian/metabase_api_python/blob/master/metabase_api/metabase_api.py#L339. However, in the friendly_names_is_disabled function, it does a self.get('/api/setting') as seen in https://github.com/vvaezian/metabase_api_python/blob/master/metabase_api/metabase_api.py#L372. This is causing a problem because according to https://github.com/metabase/metabase/blob/master/docs/api-documentation.md#setting, GET /api/setting/ is only available to superuser, so even though Friendly Table and Field Names is already set to disable by the Admin, a non superuser is still unable to use the get_columns_name_id function because self.get('/api/setting') returns False for a non superuser. Is it possible to consider the scenarios for a non superuser?

vvaezian commented 2 years ago

Hi @jasjuang , thanks for the feedback. I'll look into this on the weekend.

vvaezian commented 2 years ago

Fixed in version 0.2.14.1 You need to pass is_admin=False:

from metabase_api import Metabase_API
mb = Metabase_API('https://...', 'username', 'password', is_admin=False)
jasjuang commented 2 years ago

@vvaezian did something went wrong with the pip deployment for 0.2.14.1? After the upgrade, from metabase_api import Metabase_API shows ModuleNotFoundError: No module named 'metabase_api'. But if I drop it back to pip install metabase-api==0.2.14 everything is back to normal.

vvaezian commented 2 years ago

@jasjuang There was an issue in the setup file. Please upgrade to 0.2.14.2 (latest version)