divinorum-webb / tableau-api-lib

An API library that allows developers to call on the methods listed in Tableau's REST API documentation.
MIT License
96 stars 34 forks source link

When using querying.get_workbooks_dataframe(conn) it throws pagination error #108

Open dbodduluru opened 1 year ago

dbodduluru commented 1 year ago

Exception has occurred: PaginationError

    The Tableau Server REST API method decorator did not return paginated results. 
    Please verify that your connection is logged in and has a valid auth token.
    If using personal access tokens, note that only one session can be active at a time using a single token.
    Also note that the extract_pages() method wrapping this call is intended for paginated results only.
    Not all Tableau Server REST API methods support pagination. 

During handling of the above exception, another exception occurred:

gvidoausejs commented 1 year ago

Just experienced this error after Tableau Server upgrade to 2022.3 from older version. Fixed with updating module to latest: pip install tableau-api_lib --upgrade

Successfully uninstalled tableau-api-lib-0.1.28 Successfully installed tableau-api-lib-0.1.50

I suggest checking if not experiencing error due to outdated module.

navedgaras commented 1 year ago

I started experiencing the same issue even though I'm using tableau-api-lib-0.1.50

divinorum-webb commented 1 year ago

@edgga what version is your server on, or are you using Tableau Online?

I just successfully ran the get_workbooks_dataframe utils function against my test environment on Tableau Server: 'serverInfo': {'productVersion': {'value': '2022.3.4', 'build': '20223.23.0214.1014'}

Maybe good to verify that the account you are using to do the querying has permissions to at least 1 project/workbook in your environment, as it's possible the pagination error could be happening due to no content being available to paginate over.

nnd-support commented 1 year ago

Getting the same error:

  File "/usr/local/lib/python3.7/site-packages/tableau_api_lib/utils/pagination.py", line 23, in get_page_attributes
    pagination = query["pagination"]
KeyError: 'pagination'
  File "/usr/local/lib/python3.7/site-packages/tableau_api_lib/utils/querying/workbooks.py", line 24, in get_workbooks_dataframe
    workbooks_df = pd.DataFrame(get_all_workbook_fields(conn=conn, all_fields=all_fields))
  File "/usr/local/lib/python3.7/site-packages/tableau_api_lib/utils/querying/workbooks.py", line 17, in get_all_workbook_fields
    all_workbooks = extract_pages(conn.query_workbooks_for_site, parameter_dict={"fields": f"fields={fields_param}"})
  File "/usr/local/lib/python3.7/site-packages/tableau_api_lib/utils/pagination.py", line 62, in extract_pages
    page_number, page_size, total_available = get_page_attributes(query=query_results, query_func=query_func)
  File "/usr/local/lib/python3.7/site-packages/tableau_api_lib/utils/pagination.py", line 29, in get_page_attributes
    raise PaginationError(query_func)
tableau_api_lib.exceptions.tableau_server_exceptions.PaginationError: 
        The Tableau Server REST API method decorator did not return paginated results. 
        Please verify that your connection is logged in and has a valid auth token.
        If using personal access tokens, note that only one session can be active at a time using a single token.
        Also note that the extract_pages() method wrapping this call is intended for paginated results only.
        Not all Tableau Server REST API methods support pagination. 

With Tableau Server version 2022.1 (API version 3.15) and tableau-api-lib-0.1.50

Sushrut773 commented 3 months ago

I am facing same error. How to resolve this issue ?

nnd-support commented 3 months ago

I am facing same error. How to resolve this issue ?

We ended up resolving it by correcting the Site URL that we were using in our code. So, my only recommendation would be to double check and make sure the URL for API endpoint that your code is accessing is accurate.