I am creating a custom download tool using the Python SDK. The output will include lengthy 30k+ lines of JSON string response. The documentation for the class Field denotes "string" to be used for all possible string data types in Alteryx. But add_field or add_field_from_xml method for RecordInfo is also asking for a fixed size, in absence of which, the following error is thrown:
Code used
self.rio = Sdk.RecordInfo(1)
# using Add Field From XML
self.rio.add_field_from_xml("<Field name=\"DownloadHeders\" type=\"V_String\" >")
self.rio.add_field_from_xml("<Field name=\"DownloadData\" type=\"V_String\" >")
# Using Add Field
self.rio.add_field("DownloadHeaders", Sdk.FieldType.string)
self.rio.add_field("DownloadData", Sdk.FieldType.string)
Error Thrown
In the scenario where I do specify the size and it exceeds the limit, following warning and error is thrown
So my question is how do I use v_string i n the python code without having to specify a fixed size for the field?
Solved! Go to Solution.
Hi @fardeen9983 , use Sdk.FieldType.v_string to add a V_String field. You will need to specify the max number of characters that field can hold, which I tend to default to the max possible of 2147483647. The actual size of the field will vary with the size of the data being stored. The function call would look something like this:
self.rio.add_field("DownloadData", Sdk.FieldType.v_string, size=2147483647)