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

Add a S.No column in CSV file #11

Closed
naveen521kk opened this issue Jun 12, 2020 · 3 comments
Closed

Add a S.No column in CSV file #11

naveen521kk opened this issue Jun 12, 2020 · 3 comments

Comments

@naveen521kk
Copy link
Collaborator

naveen521kk commented Jun 12, 2020

I think we need to add an S.No column in CSV file as it would be quite helpful while checking between SQL and CSV. What do you think @Aathish04

@Aathish04
Copy link
Owner

Aathish04 commented Jun 12, 2020

I don't think it's necessary, as we can just count the number of rows at runtime.
@naveen521kk

@naveen521kk
Copy link
Collaborator Author

naveen521kk commented Jun 12, 2020

I had an option to set auto_increment of rows in sql. It might be quite helpful. If CSV file also has one.

@naveen521kk
Copy link
Collaborator Author

I achieved that with

rows= [
            (csv_reader.line_num-1,)+tuple(
                row[fieldname] for fieldname in csv_reader.fieldnames
            )for row in csv_reader
        ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants