mathesar icon indicating copy to clipboard operation
mathesar copied to clipboard

Mapping suggestions

Open Anish9901 opened this issue 2 years ago • 1 comments

Fixes #1820

This PR introduces a /mapper endpoint which returns the suggestions for column mappings in the form of column indices.

Technical details

This can handle discrepancies in column names like:

  • Perfect names but in a different order
  • Case mismatch
  • Column names containing underscores instead of spaces
  • Mixture of the above

An exception is raised when no mappings are found and are reflected in the API.

After mappings are found they are validated to ensure that the type of the temp table columns can be type casted to that of the type of target table columns if they differ in data types.

Checklist

  • [x] My pull request has a descriptive title (not a vague title like Update index.md).
  • [x] My pull request targets the master branch of the repository
  • [x] My commit messages follow best practices.
  • [x] 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).
  • [x] 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.

Anish9901 avatar Sep 19 '22 18:09 Anish9901

Codecov Report

Base: 92.60% // Head: 92.44% // Decreases project coverage by -0.15% :warning:

Coverage data is based on head (16358f4) compared to base (bf2693a). Patch coverage: 45.83% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1698      +/-   ##
==========================================
- Coverage   92.60%   92.44%   -0.16%     
==========================================
  Files         146      146              
  Lines        7099     7122      +23     
==========================================
+ Hits         6574     6584      +10     
- Misses        525      538      +13     
Flag Coverage Δ
pytest-backend 92.44% <45.83%> (-0.16%) :arrow_down:

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

Impacted Files Coverage Δ
mathesar/models/base.py 92.87% <25.00%> (-1.20%) :arrow_down:
mathesar/api/db/viewsets/tables.py 70.14% <33.33%> (-2.87%) :arrow_down:
...r/api/exceptions/database_exceptions/exceptions.py 89.81% <75.00%> (-0.57%) :arrow_down:
db/columns/exceptions.py 100.00% <100.00%> (ø)
mathesar/api/exceptions/error_codes.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Sep 20 '22 18:09 codecov-commenter