-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Falsely derived type bigint #778
Comments
@juliangrube1988 thanks for reporting this. Sadly, I don't think there's any easy fix. In the case of Property, QL has to guess what the DB type should be, which happens here: If this is the first time QL sees that property for an entity, it will have to determine the DB column type and after that point, the column type can't be changed. (Unfortunately this is a limitation with QL which would be very hard to work around given the current implementation.) Now if you'd like to have a float type in the DB, the first value you send should be a float. Sending 0 as first value, will result in an integer DB type, because to Python 0 is an int: >>> isinstance(0, int)
True and this check happens in the code I linked above before the float type check---we can't change this for backward-compatibility reasons. So if you want float, the first value you send should be >>> isinstance(0.0, int)
False
>>> isinstance(0.0, float)
True Can you try testing again but this time sending Thanks alot! |
Thanks for the quick reply! Unfortunately this won't solve our Problem since we use ngsi-ld and data are transferred as json between services. I am currently using a workaround by changing the sql_translator.py to always use float for numbers. |
Ha! I see what your problem is now. Then what I suggested won’t help since technically JSON makes no distinction between integer and floating-point: So a service is free to output
yes, you can do that—as long as you stick with NGSI-LD and never handle v2 data :-) |
Describe the bug
I have a problem with the tables created for the entities:
The first data record determines the type of the table. If the first data record is 23.0, for example, a column with the type Bigint is created, but the next data type can be 23.1 and now only zero is written into the database for the property.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Quantumleap should derive Number/Float instead of Integer since the data are transmitted from IOTAgent to Context Broker to Quantumleap as JSON Number.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: