KxSystems/embedPy

No conversion for guid from q to Python

igorii opened this issue · 4 comments

There appears to be no conversion from a q guid to Python when using .p.set. It would be useful if guids were received as strings so that Python libraries could still be used with tables containing guids, and without first cleansing q tables from having guids.

.p.set[`foo; 0ng]
'set: bad argument type for built-in operation
  [1]  /Users/tim/q/p.q:44: {[f;x;y]f[x]unwrap y;}

Hey Tim,

That's a known limitation of the interface. The reasoning behind which is a lack of direct type conversions at the Python interface level. The method that is generally used and suggested is to convert the guids to strings on q-side and re-convert to uuid.uuid objects on python side.

If this was to be implemented at the interface level the same conversion methodology would be taken and performance unlikely to be any different. It also adds module dependancies to the interface which are currently not required and largely undesired (the interface can be run in the absence of any libraries in theory).

We'll investigate this in the future but we do not currently have a timeline on adding this as a feature.

I don't see any reference to the current lack of support on the embedPy site on code.kx.com, or in the repo. In the interim, pointing out any incompatibilities and their workarounds as you mention here would be useful within documentation.

Yes that's a fair addition, I'll get this added to the FAQ on code.kx.com. Will revert here with a link to the page and an update as appropriate.

The reasoning behind the omission of this conversion as default within the interface and a workable solution for conversion of guid arrays between the two languages has now been added to the documentation.

https://code.kx.com/v2/ml/embedpy/faq/#how-do-i-convert-between-q-and-python-guids

I'm going to close this issue for now but will add information if guid conversion is added in a later release of embedPy. We will review the conversion in the future but there are currently no plans to provide this functionality at an interface level.