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

CSV import: "first line contains column names" doesn't work #17014

Closed
fgrueninger opened this issue Jul 15, 2021 · 3 comments
Closed

CSV import: "first line contains column names" doesn't work #17014

fgrueninger opened this issue Jul 15, 2021 · 3 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
Milestone

Comments

@fgrueninger
Copy link

fgrueninger commented Jul 15, 2021

Describe the bug

When importing a .csv, clicking "The first line of the file contains the table column names" doesn't work (see below).

To Reproduce

  1. Create a new table by uploading this .csv:
"Row 1","Row 2"
"123","456"
  1. Check the results:
INSERT INTO `test123`.`test` (`Row 1`, `Row 2`) VALUES ('Row 1', 'Row 2'), ('123', '456');;

Expected behavior

The first line of the .csv is not being inserted as data.

Screenshots

image

Server configuration

https://demo.phpmyadmin.net/

  • phpMyAdmin 5.1.1
  • Server: phpMyAdmin demo - MySQL (192.168.30.23 via TCP/IP)
  • Server type: MySQL
  • Server connection: SSL is not being used Documentation
  • Server version: 8.0.18 - MySQL Community Server - GPL
  • Protocol version: 10
  • User: root@192.168.30.20
  • Server charset: UTF-8 Unicode (utf8mb4)

Client configuration

  • Browser: Firefox 90
  • Operating system: Windows 10

Additional context

I think this used to work in the past :-)

@taulantxhakli
Copy link

I have had this happen to me before.
One thing you can do, which is not the most elegant way, is to delete that row after the csv importing when the The first line of the file contains the table column names (if this is unchecked, the first line will become part of the data) tick had been selected. This can be done using a SELECT query or just use the interface to make it easier.

Another way to do it is to enter 1 in the Skip this number of queries (for SQL) starting from the first one, then enter the header names where it asks in Import these many number of rows in the Format-specific options section when importing the csv. This should be done in the same format as in the csv file, like such 'day','month','year' as an example.

If you need more clarification, feel free to reply.

@williamdes williamdes added this to Needs triage in issues via automation Jul 27, 2021
@williamdes williamdes added this to the 5.1.2 milestone Jul 27, 2021
@williamdes williamdes added the Bug A problem or regression with an existing feature label Jul 27, 2021
@williamdes
Copy link
Member

Thanks !
I can confirm this using the test data you provided on 5.1.2-dev

@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Aug 9, 2021
@williamdes williamdes self-assigned this Aug 10, 2021
williamdes added a commit that referenced this issue Aug 10, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Aug 10, 2021
Pull-request: #17064
Ref: #17014

This commit is the proof that the PR was right and that it works

Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Aug 10, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from Needs triage to Closed Aug 10, 2021
@williamdes
Copy link
Member

Hi everybody, this will be part of the release 5.1.2
It is already part of the latest phpMyAdmin 5.1+snapshot

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
issues
  
Closed
Development

No branches or pull requests

3 participants