Skip to content
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

Neat 239 a has data filter can reference at most 10 views and or containers #445

Conversation

nikokaoja
Copy link
Collaborator

[0.76.3] - 10-05-24

Added

  • Added schema validator for performance, specifically if views map to too many containers.

Copy link
Collaborator

@doctrino doctrino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today, neat is never using a HasData filter on views, so I don't think we should introduce a Warning on too many views in a filter.

Furthermore, I would just raise the warning in the place were the filter is created. Then it is simpler, creating a PR to demonstrate. This seems more complex than necessary.

cognite/neat/rules/issues/dms.py Show resolved Hide resolved
Copy link

github-actions bot commented May 10, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
19893 13511 68% 60% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
cognite/neat/_version.py 100% 🟢
cognite/neat/rules/issues/dms.py 72% 🟢
cognite/neat/rules/models/dms/_schema.py 85% 🟢
cognite/neat/rules/models/dms/_validation.py 95% 🟢
TOTAL 88% 🟢

updated for commit: 8926d63 by action🐍

Copy link
Collaborator

@doctrino doctrino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One suggestion.

Comment on lines +81 to +87
for view_id in view_inheritance:
if implemented_view := indexed_views.get(view_id):
inherited_referenced_containers |= implemented_view.referenced_containers()
else:
raise IncompleteSchemaError(missing_component=view_id).as_exception()

return directly_referenced_containers | inherited_referenced_containers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks this helped, I struggled with the last one.

Comment on lines +67 to +70
indexed_views = {
**{view.as_id(): view for view in self.views},
**({view.as_id(): view for view in self.reference.views} if self.reference else {}),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest adding this as a cached_property as it is independent of the method input.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, that will cause issues if more views are added later.

@nikokaoja nikokaoja merged commit c014821 into main May 10, 2024
7 checks passed
@nikokaoja nikokaoja deleted the NEAT-239-A-hasData-filter-can-reference-at-most-10-views-and-or-containers branch May 10, 2024 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants