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 option for importing CSV #6

Closed
simonw opened this issue Nov 12, 2021 · 2 comments
Closed

--csv option for importing CSV #6

simonw opened this issue Nov 12, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Owner

simonw commented Nov 12, 2021

Right now CSV is handled by an obtuse recipe in https://github.com/simonw/git-history/blob/84663eeb60fc5f35f6845597d1cddb85e70b8f19/README.md#custom-conversions-using---convert

git-history file trees.db ../sf-tree-history/Street_Tree_List.csv \
  --repo ../sf-tree-history \
  --import csv \
  --import io \
  --convert 'list(csv.DictReader(io.StringIO(content.decode("utf-8"))))' \
  --id TreeID

This could and should be easier! Maybe a --csv option that does that for you?

@simonw simonw added the enhancement New feature or request label Nov 12, 2021
@simonw simonw changed the title Make it easier to import csv --csv option for importing CSV Nov 12, 2021
@simonw
Copy link
Owner Author

simonw commented Nov 12, 2021

I'm going to leave the example in the documentation but change it to use a different delimiter.

@simonw
Copy link
Owner Author

simonw commented Nov 12, 2021

git-history file trees.db ../sf-tree-history/Street_Tree_List.csv \
  --repo ../sf-tree-history \
  --import csv \
  --import io \
  --convert 'list(csv.DictReader(io.StringIO(content.decode("utf-8"))), delimiter=";")' \
  --id TreeID

simonw added a commit that referenced this issue Nov 12, 2021
While testing #6 I realized that a CSV file with 150,000+ lines
results in incredibly long error  messages
@simonw simonw closed this as completed in 1a33ba4 Nov 12, 2021
simonw added a commit that referenced this issue Nov 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant