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

Expose schema enforcement via SimpleKGPipeline #315

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NathalieCharbel
Copy link
Contributor

Description

This PR fixes an issue from PR#296, where the enforce_schema parameter was mistakenly omitted from SimpleKGPipeline, preventing the optional schema enforcement feature from being enabled. This update adds the missing parameter, allowing users to configure schema enforcement as intended.

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Documentation update
  • Project configuration change

Complexity

Note

Please provide an estimated complexity of this PR of either Low, Medium or High

Complexity:

How Has This Been Tested?

  • Unit tests
  • E2E tests
  • Manual tests

Checklist

The following requirements should have been met (depending on the changes in the branch):

  • Documentation has been updated
  • Unit tests have been updated
  • E2E tests have been updated
  • Examples have been updated
  • New files have copyright header
  • CLA (https://neo4j.com/developer/cla/) has been signed
  • CHANGELOG.md updated if appropriate

@NathalieCharbel NathalieCharbel requested a review from a team as a code owner March 21, 2025 14:30
@@ -81,6 +85,7 @@ def __init__(
entities: Optional[Sequence[EntityInputType]] = None,
relations: Optional[Sequence[RelationInputType]] = None,
potential_schema: Optional[List[tuple[str, str, str]]] = None,
enforce_schema: str = "NONE",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this type be Optional[SchemaEnforcementMode] instead and default to None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two things here:

  • we wanted SimpleKGPipeline to accept a string and convert it internally to the enum value (for consistency with on_error param)
  • as for Optional, I don't mind. I initially made it similar to what we have with on_error, but I also thought having it like this will avoid extra conditions for None values. It is also "semantically" different (SchemaEnforcementMode.NONE means that we know the enforcement option chosen by the user -> no enforcement , None means the choice of schema enforcement is unset or unknown). But maybe we don't care? wdyt?

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