Python - fetch multivariate - decode base64

13 views
Skip to first unread message

CD_KND

unread,
Mar 6, 2020, 12:57:43 PM3/6/20
to Warp 10 users
Hi to all,
Using Python and making a call to the Warp10 api the result of my fetch is the following:

1558099800000000/45.295249982737005:-4.682780038565397/ MyData{device_id=device1,.app=MyFirstWarpApp} b64:eDYfiwgAAAAAAAAAM2DcwmXANIHHgLEJSC_gNWDs0zNgWqdmwHCO2aT-BwMYYDIArFcehjcAAAAhAA
=1558099799000000/45.295249982737005:-4.682780038565397/ b64:eDcwAIQBMAL2CzABggowAqANMAGOLjACriYwAM4DNH_4AAAAAAAANH_4AAAAAAAANH_4AAAAAAAAAA
=1558099798000000/45.29522999189794:-4.6828200202435255/ b64:eDYfiwgAAAAAAAAAM2BcwmXA9IPbgLEJSC_gNWDs0zNgWqdmwHCO2aT-BwMYYDIAPmTB8jcAAAAhAA
=1558099797000000/45.29519998468459:-4.68300006352365/ b64:eDYfiwgAAAAAAAAAM2BcwGXA9IvbgLEJSC_gNWDs0zNgWqdmwHCO2aT-BwMYYDIAHPsTFzcAAAAhAA
=1558099796000000/45.29519998468459:-4.68300006352365/ b64:eDYfiwgAAAAAAAAAM2BcwGXA9IvbgLEJSC_gNWDs0zNgWqdmwHCO2aT-BwMYYDIAHPsTFzcAAAAhAA

According to https://www.warp10.io/content/03_Documentation/03_Interacting_with_Warp_10/04_Fetching_data/01_Fetching_data, the b64 part at the end of each line contains the multivariate data. I understand that I could use the WarpScript function MVINDEXSPLIT to convert this but I would also like to do know how to do this directly in my python code. Has anyone figured how to do this?
Thank you,

CD

Mathias Herberts

unread,
Mar 7, 2020, 9:16:18 AM3/7/20
to Warp 10 users
Hi,

WarpScript has the ->PICKLE and PICKLE-> functions which can serialize things using the pickle format natively supported by Python. You might be better off performing the MVINDEXSPLIT and extracting the values you want into a suitable data structure then 'pickle' it and return it to your Python script which will be able to process it.

Attempting to replicate the behavior of MVINDEXSPLIT in Python would force you to basically rewrite the function and all the supporting code for decoding GTSEncoders in Python, this is a classic anti-pattern of time series databases, i.e. considering they are only a "database" and simply fetching the data to later apply application logic in another environment and could prove expensive in terms of development time.
Reply all
Reply to author
Forward
0 new messages