A twbx file IS a zip file (just with a different extension). So there is no need to re-zip this file. You can open a twbx file with 7zip, and unzip it to get at the twb file inside. When you say 'update the twb' file, what exactly do you mean? Also how are you distributing to your end users?
Yup I know it is a zip file but I wasnt aware that 7Zip would recognize the extension. Are you saying you can modify the contents of the twbx files without extracting? Because my current process is to extract, update the twb file, and then archive with 7Zip again.
I am currently iterating through a couple different nodes in the twb file and updating some descriptions of terms. The only way end users will see the changes is when I publish the report back to our tableau web location after I publish nightly.
First, yes 7-Zip does recognize twbx as a file it can 'open' (although this may be because I set that up, though I don't think so):
Mark, I'm still a little unclear as to what you are doing. The twb file only contains metadata (as XML). It does not contain any data. The data is in a file structure that Tableau created when you created the packaged workbook. So when you say:
I am currently iterating through a couple different nodes in the twb file and updating some descriptions of terms.
You mean you are opening the file in Tableau Desktop, making changes and then trying to save these changes? Or do you mean you are opening the XML in NotePad ++ and editing the XML to make these changes?
If it is the first, then you are going the long way around. Instead of unpackaging (unzipping), just open the twbx in Desktop and then immediately save the file as an unpackaged workbook (twb). Tableau will ask you where you want to save the other resources in the twbx. I think it defaults to the same folder the original file was in. Now make your changes, then when you're done go to File\Export Packaged workbook. T will repackage it, and you're done.
Let me know if you are editing the XML, and why. You know of course this is unsupported.
I am not physically opening anything, this is all being done in .net c# code that I wrote. I am updating the twb file within the process.
To comment on the first thing you mentioned, I would have to test to see if the 7Zip command line tool (z7a,exe) would perform the same action. I am not actually right clicking on a twbx file and browsing the contents of the zipped file.
I am updating the description node of the column nodes in the XML file. Meaning that I am adding a "data definition" to that term in the workbook.
My overall need is to update the Comment for each dimension or measure with the terms definition from a SQL table. (When you hover over a dimension of measure in a workbook it will show the comment if there is one available for that value) I am able to do all of this until it comes time to publish. To edit a Comment right click on the dimension, navigate to Default properties, and then select Comment. You can add the value here.
I cannot just open this in Tableau desktop and update the workbook and save, this is supposed to be an automated process. I have read a lot of blogs about people doing so and they have gotten me this far.
This may be an unsupported process by Tableau but it isnt hurting anything. This is to enrich our companies reports with data definitions so the users understand what the dimensions and measures represent.
Do you have any development background that might help me out here?
OK, now I understand. This is way outside my wheelhouse, so I'm going to move this over to the Developer space, where you're more likely to get help with this.
Oh thank you, sorry for posting in the wrong section
No worries. Sometimes it might actually be best to post in the forums (more exposure) and then move it to the Developers space, if need be.
Good luck, hope you get some help. Maybe Bora Beran will jump in; he's been hanging around this morning (afternoon).
1 of 1 people found this helpful
This is not my forté either but I will ask around. My first guess would be that C#'s ZipFile is doing something different. I have seen bugs around this in the past (not necessarily on twb) where people would compress in C# using ZipFile but will get errors "unsupported compression method" when try to unzip with other tools like 7zip or WinZip.
I was thinking that Tableau didnt support the compression method that I was using with 7zip but tried a few different styles. I also tried one that didnt compress at all. Still no luck.
I checked file sizes before and after compressing and zipping files, and I could never get a matching file size (even if I didnt change the XML file). I did get super close with -mx1 compression in 7Zip. It was only off by a couple KBs. I am looking around now to see if maybe someone had better luck with the compression.
Hi Mark, try doing the update manually in desktop and then comparing this to the twbx generated by your program. Use 7-zip to examine both files. First look at the table of contents (what 7-zip shows you), and if the two twbx files match (other than date and size), then extract the twbs and compare. I am assuming the other contents is touched, so its size and date should remain unchanged.
If this doesn't identify the problem, what error message are you seeing? Is there any more information in the log file? Perhaps this might help indicate where you've gone wrong.
I can give that a try, but I didnt even edit either file. Unless you are saying that compressing the file will change the contents in some way.
The error in TABCMD that I am getting is
" ***Bad Request - An unexpected error occurred opening the packaged workbook. "
This happens after it shows that the upload progress finished to 100% and it says "Publishing". So it seems that it is having trouble viewing the file. Is there a log for TABCMD? Somewhere that shows more detailed failure messages?
Your original posting said you updated the twb. Given that error message, it sounds possible that your repackaging did not produce the expected results. 7-zip will display the compression methods used, so make sure that the results after your update match the original (for example, make sure that you are not using 7z compression).
Correct, I am trying to figure out what sort of compression is used for Tableau and what should be used to upload into Tableau. I have tried used Windows "send to compressed folder" option, didnt work in the upload process. I have tried with 7-zip's programmatic library with a few different compression methods and still no luck. So far no compression method is acceptable for Tableau.
Someone mentioned in a blog post that each file in a TWBX archive is compressed individually and then the folder as a whole is compressed. I wonder if that is something to think about.
To answer your question I am currently zipping to a .zip archive with 7zip with one of its many compression types.
Switch -mx0: Don't compress at all.
This is called "copy mode."
Switch -mx1: Low compression.
This is called "fastest" mode.
Switch -mx3: Fast compression mode.
Will automatically set various parameters.
Switch -mx5: Same as above, but "normal."
Switch -mx7: This means "maximum" compression.
Switch -mx9: This means "ultra" compression.
You probably want to use this.
This is coming from: http://www.dotnetperls.com/7-zip-examples
Can you compare the compression modes before and after?