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

Add db specific node class registry #806

Merged
merged 3 commits into from
Jul 2, 2024

Conversation

mariusconjeaud
Copy link
Collaborator

@mariusconjeaud mariusconjeaud commented May 30, 2024

Today, neomodel uses a single node class registry, to prevent collision of labels inside the database.

So this would not work :

class PatientOne(AsyncStructuredNode):
        __label__ = "Patient"
        name = StringProperty()

class PatientTwo(AsyncStructuredNode):
        __label__ = "Patient"
        identifier = StringProperty()

This PR adds a database-specific node class registry so that in the context of multiple databases, two different StructuredNode classes can map into the same label, but in different databases :

class PatientOne(AsyncStructuredNode):
        __label__ = "Patient"
        __target_databases__ = ["db_one"]
        name = StringProperty()

class PatientTwo(AsyncStructuredNode):
        __label__ = "Patient"
        __target_databases__ = ["db_two"]
        identifier = StringProperty()

@mariusconjeaud mariusconjeaud added this to the 5.3.2 milestone May 30, 2024
@mariusconjeaud mariusconjeaud self-assigned this May 30, 2024
Copy link

codecov bot commented May 30, 2024

Codecov Report

Attention: Patch coverage is 96.55172% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 91.47%. Comparing base (7c6662a) to head (53ff6fc).

Files Patch % Lines
neomodel/async_/core.py 96.00% 1 Missing ⚠️
neomodel/sync_/core.py 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           rc/5.3.2     #806   +/-   ##
=========================================
  Coverage     91.47%   91.47%           
=========================================
  Files            34       34           
  Lines          4574     4600   +26     
=========================================
+ Hits           4184     4208   +24     
- Misses          390      392    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented May 30, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
18.8% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@mariusconjeaud mariusconjeaud merged commit deb1ad2 into rc/5.3.2 Jul 2, 2024
32 of 33 checks passed
@mariusconjeaud mariusconjeaud deleted the feature/db-specific-registry branch July 2, 2024 07:04
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.

1 participant