Skip to content

Conversation

@delsner
Copy link
Member

@delsner delsner commented Jun 12, 2025

Motivation

Fixes #51.

Changes

Add dynamic name property to dy.Column.

@delsner delsner self-assigned this Jun 12, 2025
@delsner delsner changed the title feat: Add alias string property to dy.Column feat: Add alias string property to dy.Column Jun 12, 2025
@github-actions github-actions bot added the enhancement New feature or request label Jun 12, 2025
@delsner delsner changed the title feat: Add alias string property to dy.Column feat: Add alias string property to dy.Column Jun 12, 2025
@codecov
Copy link

codecov bot commented Jun 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e0c30b4) to head (c8570b5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #52   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           41        41           
  Lines         2148      2153    +5     
=========================================
+ Hits          2148      2153    +5     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@borchero borchero left a comment

Choose a reason for hiding this comment

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

I had one thought: could we somehow make .col and .alias (or something like .name) be populated dynamically? Specifically, we could overwrite __getattr__ (or __getattribute__, I always forget what's the right one) of Schema and set the column name there, i.e.

def __getattr__(self, name: str) -> Any:
    val = super().__getattr__(name)
    if isinstance(val, Column):
        val.name = val.alias or name
    return val

That would also allow fixing the problem that we had discussed previously where you can't set the column of a schema based on the column of another schema, i.e. something like

column = OtherSchema.column_with_other_name

@delsner delsner changed the title feat: Add alias string property to dy.Column feat: Add name string property to dy.Column Jun 17, 2025
@delsner delsner requested a review from borchero June 18, 2025 05:05
Copy link
Member

@borchero borchero left a comment

Choose a reason for hiding this comment

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

Nice!

@delsner delsner merged commit c25880e into main Jun 18, 2025
18 checks passed
@delsner delsner deleted the alias-property branch June 18, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Accessing a columns name via .alias makes the type checker complain

3 participants