-
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
added ql version in metadata #615
base: master
Are you sure you want to change the base?
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ |
Hi @chicco785 @c0c0n3 , I have done some changes in code test case are passing but still autopep8 is failing not able to get exact cause why it is failing. |
hi @daminichopra :-) I'm not sure why autopep is failing, I looked at the logs but couldn't find any useful clues. We'll look into this. In the meantime, if you could please review my suggestion below and implement it if you agree with the proposed changes. We've got to store the version number in a single place to avoid grief down the line. So I suggest we add a # Most recent official release
__version_info__ = ('0', '8', '3')
__version__ = '.'.join(__version_info__)
# Current dev version for the next release
__dev_version__ = '0.9.0-dev' See also this SO question about app versions Once this module is in place, replace all hard-coded version numbers scattered around the code with the constants defined above. For example, here's what the reporter.version module should look like from _version import __dev_version__
def version():
return {
'version': __dev_version__
} Same applies to the module's test. On the other hand, you should use the Thank you so much! |
@c0c0n3 , Incorporated comments suggested and updated PR. |
@daminichopra thank you sooo much that's great. We're going to need some tests though :-) But before you do that, let's wait for @chicco785 to comment on this PR since I remember him mentioning he had something different in mind when he wrote #591? |
@c0c0n3 , Sure |
@daminichopra thanks for this contrib, we just need you to add some tests to check that the QL version gets written to the meta table...Any chance you could you do that? Thanks alot!!! |
src/translators/tests/test_insert.py
Outdated
} | ||
|
||
def assert_entity_attrs_meta_version(translator, entity): | ||
data = select_entity_attrs_meta_version(translator, entity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does this function come from? can you please check if this is something you need to push upstream? thanks :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@c0c0n3 I didn't find this function. I have updated the test file for version check.
@c0c0n3 @chicco785 I have updated this PR. Please let me know in case any other change is required to merge this PR. |
@c0c0n3 @chicco785 I have updated the PR. If you can spare sometime for review and let me know in case any further change is required. |
@daminichopra @pooja1pathak thank you for the reminder. We've been busy w/ other projects and this PR fell through the cracks. Soooo sorry about that. Anyhoo, we've just checked out your branch and had a look at the code which is mostly fine, but we'd like to change where the version gets stored in the DB. At the moment it ends up being stored as an NGSI attribute in the meta table. E.g. with two tables table_name | entity_attrs
-------------------------
"et0" | {"ql_version":["0.8.3","Text"],"attr_bool":["attr_bool","Boolean"],"entity_type":["type","Text"],"time_index":["time_index","DateTime"],"attr_geo":["attr_geo","geo:json"],"attr_time":["attr_time","DateTime"],"attr_str":["attr_str","Text"],"entity_id":["id","Text"],"attr_float":["attr_float","Number"]}
"et1" | {"ql_version":["0.8.3","Text"],"attr_bool":["attr_bool","Boolean"],"entity_type":["type","Text"],"time_index":["time_index","DateTime"],"attr_geo":["attr_geo","geo:json"],"attr_time":["attr_time","DateTime"],"attr_str":["attr_str","Text"],"entity_id":["id","Text"],"attr_float":["attr_float","Number"]} Ideally the version should be stored in a separate column since it's an property of the table, not of the NGSI entities? So the table should probably look something like table_name | version | entity_attrs
-----------------------------------
"et0" | "0.8.3" | {"attr_bool":["attr_bool","Boolean"],"entity_type":["type","Text"],"time_index":["time_index","DateTime"],"attr_geo":["attr_geo","geo:json"],"attr_time":["attr_time","DateTime"],"attr_str":["attr_str","Text"],"entity_id":["id","Text"],"attr_float":["attr_float","Number"]}
"et1" | "0.8.3" | {"attr_bool":["attr_bool","Boolean"],"entity_type":["type","Text"],"time_index":["time_index","DateTime"],"attr_geo":["attr_geo","geo:json"],"attr_time":["attr_time","DateTime"],"attr_str":["attr_str","Text"],"entity_id":["id","Text"],"attr_float":["attr_float","Number"]} But I'll let @chicco785 comment on this if he thinks it's best to have the version column stored somewhere else rather than an additional meta column. |
1 similar comment
@daminichopra @pooja1pathak thank you for the reminder. We've been busy w/ other projects and this PR fell through the cracks. Soooo sorry about that. Anyhoo, we've just checked out your branch and had a look at the code which is mostly fine, but we'd like to change where the version gets stored in the DB. At the moment it ends up being stored as an NGSI attribute in the meta table. E.g. with two tables table_name | entity_attrs
-------------------------
"et0" | {"ql_version":["0.8.3","Text"],"attr_bool":["attr_bool","Boolean"],"entity_type":["type","Text"],"time_index":["time_index","DateTime"],"attr_geo":["attr_geo","geo:json"],"attr_time":["attr_time","DateTime"],"attr_str":["attr_str","Text"],"entity_id":["id","Text"],"attr_float":["attr_float","Number"]}
"et1" | {"ql_version":["0.8.3","Text"],"attr_bool":["attr_bool","Boolean"],"entity_type":["type","Text"],"time_index":["time_index","DateTime"],"attr_geo":["attr_geo","geo:json"],"attr_time":["attr_time","DateTime"],"attr_str":["attr_str","Text"],"entity_id":["id","Text"],"attr_float":["attr_float","Number"]} Ideally the version should be stored in a separate column since it's an property of the table, not of the NGSI entities? So the table should probably look something like table_name | version | entity_attrs
-----------------------------------
"et0" | "0.8.3" | {"attr_bool":["attr_bool","Boolean"],"entity_type":["type","Text"],"time_index":["time_index","DateTime"],"attr_geo":["attr_geo","geo:json"],"attr_time":["attr_time","DateTime"],"attr_str":["attr_str","Text"],"entity_id":["id","Text"],"attr_float":["attr_float","Number"]}
"et1" | "0.8.3" | {"attr_bool":["attr_bool","Boolean"],"entity_type":["type","Text"],"time_index":["time_index","DateTime"],"attr_geo":["attr_geo","geo:json"],"attr_time":["attr_time","DateTime"],"attr_str":["attr_str","Text"],"entity_id":["id","Text"],"attr_float":["attr_float","Number"]} But I'll let @chicco785 comment on this if he thinks it's best to have the version column stored somewhere else rather than an additional meta column. |
@c0c0n3 , I have updated the PR as per your suggestion. Kindly review and let me know in case any other change is required. |
@pooja1pathak thanks so much for accommodating this refactoring. One thing that I'm still not sure about is what's going to happen in the case of upgrading QuantumLeap from a previous version. In that case, we should assume there's already a QuantumLeap DB in place, either Crate or Timescale, with a metadata table in it. Now that table, having being created by a QL version released before this PR, won't have the version column in it. I've got a sneaking suspicion our current approach won't work in this scenario? The |
@c0c0n3 I have checked above scenario, Please find below observations:
As per my observation, the this implementation will not cause any issue with the current code. Please suggest if any other improvement is needed from my side or we can merge this PR. |
@pooja1pathak excellent work! Can you test with Timescale as a backend too? Just for peace of mind since Crate might work b/c of the dynamic table policy---or maybe there's something else which makes it work. The test should be the same of what you've done w/ Crate:
Thank you so much! |
@c0c0n3 I have checked timescale as per your suggestion. Timescale's behavior is different from crateDB. metadata table is created for the first time with QL 0.8.3, but when I replace QL with branch daminichopra:Issue#519 and then perform the notify operation for same and different entity type and fiware-service. In both the cases metadata table is not updated. I am looking into it to find the real cause and will update the PR if I find any solution. |
Proposed changes
Stored
ql_version
in metadataTypes of changes
What types of changes does your code introduce to the project: Put
an
x
in the boxes that applyfunctionality to not work as expected)
Checklist
Put an
x
in the boxes that apply. You can also fill these out aftercreating the PR. If you're unsure about any of them, don't hesitate to
ask. We're here to help! This is simply a reminder of what we are going
to look for before merging your code.
feature works
downstream modules
Further comments
Fix for Issue