FraunhoferIOSB / FROST-Python-Client

Python Client Library for FROST.
GNU Lesser General Public License v3.0
8 stars 8 forks source link

Id type string #12

Closed tfeseker closed 1 year ago

tfeseker commented 1 year ago

I've made changes to enable the use of IDs of type STRING - should also work for type UUID. This should close the related issue: https://github.com/FraunhoferIOSB/FROST-Python-Client/issues/9#issue-1552775495

tfeseker commented 1 year ago

The current version of the extract value method returns whatever is in between the brackets of the header field as the ID of the newly created entity as a str object. In case of integer IDs, this is the integer (as a str). In case of String IDs, this is a str that includes the single quotes (which are inside the brackets!).

The create method of the base dao then tries to cast this return value to an int. Obviously, this works fine for Integer IDs. For String IDs, however, there are two problems:

I tried to solve this issue by determining if the id is int or str when extracting the value and get rid of the single quotes. Seems to work for me and should also still work with Integer IDs.

emdekatharina commented 1 year ago

you are right, thanks for the update.