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 empty column name with "column_X" #1255

Merged
merged 4 commits into from
Apr 7, 2022
Merged

replace empty column name with "column_X" #1255

merged 4 commits into from
Apr 7, 2022

Conversation

A1O
Copy link
Contributor

@A1O A1O commented Mar 31, 2022

Fixes #1003

Now all csv files are treated as headed files for preview. This pull request generates a column name "column_X" for empty column name.

Technical details

Other possible solution is to import csv file as headless file by default.

Screenshots

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.

@A1O A1O requested review from a team and silentninja March 31, 2022 09:44
@silentninja silentninja self-assigned this Mar 31, 2022
@silentninja silentninja added the pr-status: review A PR awaiting review label Mar 31, 2022
@kgodey
Copy link
Contributor

kgodey commented Apr 1, 2022

We should probably use Column X (no underscore) to be consistent with how we're generating columns on the backend, see #1194

Copy link
Contributor

@silentninja silentninja left a comment

Choose a reason for hiding this comment

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

Can you add a test case to confirm if the PR solves the issue or mention an existing test case that can confirm the behaviour?

mathesar/imports/csv.py Outdated Show resolved Hide resolved
@silentninja silentninja added pr-status: revision A PR awaiting follow-up work from its author after review and removed pr-status: review A PR awaiting review labels Apr 1, 2022
@silentninja silentninja assigned A1O and unassigned silentninja Apr 1, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 1, 2022

Codecov Report

Merging #1255 (3370370) into master (2e80bd9) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1255   +/-   ##
=======================================
  Coverage   93.41%   93.42%           
=======================================
  Files         113      113           
  Lines        4330     4332    +2     
=======================================
+ Hits         4045     4047    +2     
  Misses        285      285           
Flag Coverage Δ
pytest-backend 93.42% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
db/columns/operations/create.py 91.15% <100.00%> (ø)
db/constants.py 100.00% <100.00%> (ø)
mathesar/imports/csv.py 92.77% <100.00%> (+0.08%) ⬆️

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 2e80bd9...3370370. Read the comment docs.

@A1O
Copy link
Contributor Author

A1O commented Apr 2, 2022

Can you add a test case to confirm if the PR solves the issue or mention an existing test case that can confirm the behaviour?

@silentninja I added a new unit test.

@kgodey I made the changes you asked for.

@A1O A1O requested a review from silentninja April 2, 2022 21:36
@kgodey kgodey assigned silentninja and unassigned A1O Apr 3, 2022
@kgodey kgodey added pr-status: review A PR awaiting review and removed pr-status: revision A PR awaiting follow-up work from its author after review labels Apr 3, 2022
Copy link
Contributor

@silentninja silentninja 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. Nice work! @A1O.

@silentninja silentninja merged commit d390b07 into mathesar-foundation:master Apr 7, 2022
@A1O A1O deleted the 1003-headerless-csv-empty-column branch April 7, 2022 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: review A PR awaiting review
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Preview table creation fails for headerless csvs when first row's column value is empty
4 participants