fix: Raise on duplicated aliases#291
Merged
AndreasAlbertQC merged 3 commits intoQuantco:mainfrom Mar 4, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #291 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 54 54
Lines 3121 3127 +6
=========================================
+ Hits 3121 3127 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds early validation to schema definition to prevent ambiguous schemas where multiple Columns resolve to the same effective column name (via alias), raising ImplementationError during class creation and adding regression tests.
Changes:
- Raise
ImplementationErrorwhen two columns in the same schema resolve to the same name (aliasor attribute name). - Raise
ImplementationErrorwhen a child schema introduces a column whose resolved name clashes with an inherited one. - Add tests covering both same-schema and inherited duplicate-alias scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
dataframely/_base_schema.py |
Adds duplicate-name checks during metadata collection/merging to raise ImplementationError early. |
tests/columns/test_alias.py |
Adds tests asserting duplicate aliases are rejected for same-schema and inherited definitions. |
AndreasAlbertQC
approved these changes
Mar 4, 2026
Collaborator
AndreasAlbertQC
left a comment
There was a problem hiding this comment.
Thanks @gab23r !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Raises an
ImplementationErrorwhen a schema contains columns with duplicate aliases.Motivation
I was using LLM to generate dataframely schemas, it gives me duplicated alias like in:
It could be nice from dataframely it icould raise in this case.
Changes