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

Remove column_index from MathesarColumn class #996

Closed
Tracked by #839
mathemancer opened this issue Jan 20, 2022 · 3 comments · Fixed by #1226
Closed
Tracked by #839

Remove column_index from MathesarColumn class #996

mathemancer opened this issue Jan 20, 2022 · 3 comments · Fixed by #1226
Assignees
Labels
ready Ready for implementation type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL

Comments

@mathemancer
Copy link
Contributor

Problem

Currently, column operations use column_index to identify columns. This is brittle, and leads to bugs. We've decided to change to attnum. Once this is done, the column_index attribute will be extraneous.

Proposed solution

We should remove the column_index attribute of the MathesarColumn class in db/columns/base.py and make sure nothing breaks.

Additional context

Blocked by:

@mathemancer mathemancer added ready Ready for implementation and removed status: triage labels Jan 20, 2022
@mathemancer mathemancer added good first issue Everything in "Help wanted", PLUS being relatively easy and straightforward to implement. help wanted Community contributors can implement this work: backend Related to Python, Django, and simple SQL labels Jan 20, 2022
@kgodey kgodey removed good first issue Everything in "Help wanted", PLUS being relatively easy and straightforward to implement. help wanted Community contributors can implement this labels Mar 1, 2022
@kgodey
Copy link
Contributor

kgodey commented Mar 16, 2022

I realized that column index is not extraneous, it should still be used by the frontend to order columns for display. See: #1185.

I do think we need to make sure nothing in the db module depends on the column_index attribute of the MathesarColumn class, but I don't think we should remove it, we need to be able to send it to the frontend easily.

@mathemancer
Copy link
Contributor Author

The attnum of a column is always in the same order as the index. I.e., if you order by attnum, it will always be the same as if you order by column index. If the API needs to return an index instead of attnum, I think we should do that as close to the actual API as possible.

@kgodey
Copy link
Contributor

kgodey commented Mar 18, 2022

Okay, makes sense. Based on conversations in #1185 and #1186, I don't think the API needs to return an index, just order by attnum, so we can go ahead and remove the index.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Ready for implementation type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL
Projects
No open projects
3 participants