8000 KeyError throwing when opening workbook · Issue #58 · tableau/document-api-python · GitHub
[go: up one dir, main page]

Skip to content

KeyError throwing when opening workbook #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
t8y8 opened this issue Jul 22, 2016 · 6 comments
Closed

KeyError throwing when opening workbook #58

t8y8 opened this issue Jul 22, 2016 · 6 comments
Assignees
Labels

Comments

@t8y8
Copy link
Contributor
t8y8 commented Jul 22, 2016

Happens in the latest commit on the development branch

Traceback (most recent call last):
  File "party.py", line 4, in <module>
    wb = Workbook('Contact Us Form - Tasks.twbx')
  File "/Users/tdoyle/Documents/py/envs/party/lib/python3.5/site-packages/tableaudocumentapi/workbook.py", line 49, in __init__
    self._workbookRoot, self._datasource_index
  File "/Users/tdoyle/Documents/py/envs/party/lib/python3.5/site-packages/tableaudocumentapi/workbook.py", line 148, in _prepare_worksheets
    datasource.fields[column_name].add_used_in(worksheet_name)
  File "/Users/tdoyle/Documents/py/envs/party/lib/python3.5/site-packages/tableaudocumentapi/multilookup_dict.py", line 66, in __getitem__
    return dict.__getitem__(self, key)
KeyError: '[Account]'

Sending workbook via email since it's internal and I can't just toss it to GH :)

@t8y8 t8y8 added the bug label Jul 22, 2016
@graysonarts graysonarts self-assigned this Jul 22, 2016
@benlower
Copy link
Contributor

are you getting this error on other workbooks, or just this one in particular?

@t8y8
Copy link
Contributor Author
t8y8 commented Jul 22, 2016

I wrote a script to run through 73 workbooks I happened to have downloaded:

23 out of 73 workboks were opened successfully
0.3150684931506849%

@RussTheAerialist and I are chatting about it on hipchat, suspect it's another xml lookup issue of some sort

@graysonarts
Copy link
Contributor

Part of these failures are because the file version is 8.0. Not all of them, so this is still a bug that needs to be tracked down, but we need to decide on what are support will be for older versions of the file format.

Also, nitpick, it's 31.5068...%, not 0.315068...%

@graysonarts
Copy link
Contributor

ah okay, I see what's going on. There is an unnamed field in this workbook. It's that feature that allows you to create temporary calculated fields on the shelves (in this case it's an LOD calc). So, when we are creating the mapping between fields and the sheets they are used in, we are processing the <datasource-dependencies> tag, we find the calculation that doesn't exist in the data source, only in the sheet's dependencies.

I'm not sure the best way to handle this situation. We do not currently have a way of surfacing those types of fields with this version of the library.

My thought is to add a if the field is in the data source, do the normal thing. If it doesn't skip it for now. I'll open an additional issue to expose the sheet specific fields once we create the sheet object.

@t8y8
Copy link
Contributor Author
t8y8 commented Jul 23, 2016

That makes sense for now, the sheet-specific calcs can be handled in a later release

@graysonarts
Copy link
Contributor

#59 fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
0