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

Querying throws an error #29

Closed anurlybayev closed 3 years ago

anurlybayev commented 3 years ago

Hello,

Following snippet:

from tableau_api_lib import TableauServerConnection
from tableau_api_lib.utils import querying

tableau_config = {
    'tableau_prod': {
        ...
    }
}
connection = TableauServerConnection(config_json=tableau_config, env='tableau_prod')
connection.sign_in()
df = querying.get_projects_dataframe(connection)
connection.sign_out()

throws an error:

Traceback (most recent call last):
  File "/Users/anurlybayev/workspace/github/hack/main.py", line 11, in <module>
    df = querying.get_projects_dataframe(connection)
  File "/Users/anurlybayev/workspace/github/hack/.venv/lib/python3.7/site-packages/tableau_api_lib/utils/querying/projects.py", line 18, in get_projects_dataframe
    projects_df = pd.DataFrame(get_all_project_fields(conn))
  File "/Users/anurlybayev/workspace/github/hack/.venv/lib/python3.7/site-packages/tableau_api_lib/utils/querying/projects.py", line 13, in get_all_project_fields
    all_projects = extract_pages(conn.query_projects, parameter_dict={'fields': 'fields=_all_'})
  File "/Users/anurlybayev/workspace/github/hack/.venv/lib/python3.7/site-packages/tableau_api_lib/utils/pagination.py", line 61, in extract_pages
    query_results = process_query(query_func=query_func, content_id=content_id, parameter_dict=parameter_dict)
  File "/Users/anurlybayev/workspace/github/hack/.venv/lib/python3.7/site-packages/typeguard/__init__.py", line 922, in wrapper
    check_argument_types(memo)
  File "/Users/anurlybayev/workspace/github/hack/.venv/lib/python3.7/site-packages/typeguard/__init__.py", line 768, in check_argument_types
    raise TypeError(*exc.args) from None
TypeError: type of argument "query_func" must be function; got method instead

Please advise?

anurlybayev commented 3 years ago

Using connection methods works as expected.

anurlybayev commented 3 years ago

The above works on the 0.1.2 version of the library.

divinorum-webb commented 3 years ago

Hi @anurlybayev sorry for the inconvenience, this bug has been patched and running pip install -U tableau-api-lib should resolve the issue.

The issue resulted from two errors on our end: 1) the typeguard package has been introduced for type checking on certain classes / functions, but was not added to the library's setup.py as a requirement 2) typeguard is being introduced to the library and an incorrect type check was applied within the pagination.py script that local tests failed to cover

Both of those issues have been patched. Please let me know if you experience any issues after upgrading the library.

anurlybayev commented 3 years ago

Confirm, this has been resolved in 0.1.5