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

Replace column index usage in db create operations with column attnum. #1110

Merged
merged 7 commits into from
Mar 4, 2022

Conversation

silentninja
Copy link
Contributor

@silentninja silentninja commented Mar 1, 2022

Fixes #995

Breaking Change

  • Column Duplication uses column id instead of column index. So source_column field in the request body of POST method of /column/ accepts column id instead of column index

Other Changes

  • Column index usage has been completely removed from column create operations and from certain column alter operations as they were being used by create operations.

  • get_columns_name_from_attnums returns a list of column attnums instead of a tuple of a row tuple with single attnum attribute

  • get_column_name_from_attnum convenience function has been introduced to help with fetching attnum for single column from column name

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the master branch of the repository
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@codecov-commenter
Copy link

codecov-commenter commented Mar 1, 2022

Codecov Report

Merging #1110 (351797e) into mathesar-993-attnum-column-drop (f7029fb) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@                         Coverage Diff                         @@
##           mathesar-993-attnum-column-drop    #1110      +/-   ##
===================================================================
- Coverage                            92.84%   92.79%   -0.05%     
===================================================================
  Files                                  112      112              
  Lines                                 4037     4052      +15     
===================================================================
+ Hits                                  3748     3760      +12     
- Misses                                 289      292       +3     
Flag Coverage Δ
pytest-backend 92.79% <100.00%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
db/columns/operations/alter.py 96.57% <100.00%> (+0.12%) ⬆️
db/columns/operations/create.py 90.29% <100.00%> (+0.29%) ⬆️
db/columns/operations/select.py 100.00% <100.00%> (ø)
db/constraints/operations/create.py 95.45% <100.00%> (+1.01%) ⬆️
db/constraints/operations/select.py 97.72% <100.00%> (ø)
mathesar/api/db/viewsets/columns.py 91.01% <100.00%> (-0.39%) ⬇️
mathesar/api/serializers/columns.py 98.79% <100.00%> (ø)
mathesar/models.py 96.12% <100.00%> (ø)
...i/exceptions/generic_exceptions/base_exceptions.py 80.00% <0.00%> (-10.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f7029fb...351797e. Read the comment docs.

@silentninja
Copy link
Contributor Author

@seancolsen SInce you are working on #1047, will you be able to fix these changes too? I can extract the breaking changes to a different PR if it will take time to fix on the frontend so as to not block other parts of the PR.

@seancolsen
Copy link
Contributor

@silentninja the front end doesn't yet have any functionality to duplicate columns and it doesn't make use of source_column. So we should be all set.

@silentninja silentninja linked an issue Mar 3, 2022 that may be closed by this pull request
Base automatically changed from mathesar-993-attnum-column-drop to master March 3, 2022 01:34
@silentninja silentninja marked this pull request as ready for review March 3, 2022 14:35
@silentninja silentninja requested review from a team and kgodey March 3, 2022 14:35
Copy link
Contributor

@kgodey kgodey left a comment

Choose a reason for hiding this comment

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

Looks good to me, please fix merge conflicts and merge.

…tions` to use table instance instead of a fixture when calling `mathesar.tests.api.test_column_api._get_columns_by_name`
@silentninja silentninja merged commit d20e8f5 into master Mar 4, 2022
@silentninja silentninja deleted the mathesar-995-column-attnum-create branch March 4, 2022 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Column creation and copying should use attnum
4 participants