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

1075/enhancement/Make col class with __getattr__ #1076

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

deanm0000
Copy link

@deanm0000 deanm0000 commented Mar 20, 2025

Which issue does this PR close?

Closes #1075

Rationale for this change

To improve ergonomics of the API by providing a quicker way of accessing columns using the __getattr__ method of classes. Using the __call__ method, the original behavior is maintained, this is only additive.
Now this is possible

from datafusion import col as c

my_a_column=c.a
my_banana_column=c.banana

What changes are included in this PR?

A new col.py file with the class. I removed the col and column function from __init__ and imported col and column from col.py. I added a test that duplicates another test but uses the new syntax.

Are there any user-facing changes?

Only optional ones as mentioned above.

No breaking changes.

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.

Add a Col class instead of just col function to use __getattr__ method
1 participant