document-api-python
document-api-python copied to clipboard
Need the ability to read from and write to the <desc> element within .tds files
In order to more efficiently manage metadata documentation regarding fields in Tableau data sources, I need the ability to read the information in the
<column datatype='string' name='[STATUS]' role='dimension' type='nominal'>
<desc>
<formatted-text>
<run bold='true' fontsize='10'>Case Mix Index VAL</run>
<run fontcolor='#686868'> The MSDRG weight for inpatients with charges > 0. Does not include inpatient rehab, normal newborns or MSDRG 999.</run>
<run bold='true' fontcolor='#297a98'> HSP_ACCT_MULT_DRGS.DRG_WEIGHT (HAR 651)</run>
</formatted-text>
</desc>
</column>
A first pass could be to add something in a simple unformatted tag -- I worry about the RTF-ness of our descriptions and trying to build an XML serializer to describe the rich text
I would be fine reading and writing everything in the
On Aug 19, 2016, at 5:35 PM, Tyler Doyle [email protected] wrote:
A first pass could be to add something in unformatted -- I worry about the RTF-ness of our descriptions
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tableau/document-api-python/issues/72#issuecomment-241141507, or mute the thread https://github.com/notifications/unsubscribe-auth/AUJiGb_XD_dP3dcpdfICOj-npxabQ55Uks5qhiG1gaJpZM4JonAJ.
Reading should be straight-forward to add since we are already parsing some of the information out of the column tags. Writing is a bit trickier since we don't currently support writing fields.
I'll see if I can get reading done this week so it's included in the august release.
Just a note that I'm doing a little research on what rtf-generating libs exist out there already.
https://github.com/grangier/pyrtf exists but seems like overkill
@RussTheAerialist I'm thinking of an approach like this, so we don't have to re-implement RTF or take a dependency on pyrtf/pyrtf-ng:
field.description.update_text('blah blah blah')
will create a simple RTF blob of
<formatted-text>
<run fontsize='10'>Blah blah blah</run>
</formatted-text>
And then we can also have
field.description.from_rtf(<RTF OBJECT FROM PYRTF OR OTHER THINGY>)
Which will insert the raw xml blob.
Could you also do a .update_xml() function so the end user could do their own formatting with the
Sent from my iPhone
On Sep 7, 2016, at 4:45 PM, Tyler Doyle [email protected] wrote:
@RussTheAerialist I'm thinking of an approach like this, so we don't have to re-implement RTF or take a dependency on pyrtg/pyrtf-ng:
field.description.update_text('blah blah blah') will create a simple RTF blob of
<formatted-text> <run fontsize='10'>Blah blah blah</run> </formatted-text>
And then we can also have
field.description.from_rtf(<RTF OBJECT FROM PYRTF OR OTHER THINGY>)
Which will insert the raw xml blob.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I'm planning to add the ability to change the formatted text. There is some pending work that needs to get done before we start enabling more edit scenarios.
I prefer the idea of an update method you can pass in text, rtf-based xml, or an rtf object that hopefully has an as_string or something similar so we can support various different ways of updating without having the change the signature.
I have some high-priority other things I need to get done unrelated to the document-api for September, so I'm not sure when I'll get to it.
Im interested this feature too. my use-case is :
- finding source schema.table.column per data-source field
- pulling field comment from database (this part happens outside of document api)
- updating field description.
thanks a lot for all the effort, this API already being very useful to my work.