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

Integrate django-import-export to allow bulk import and export #384

Merged
merged 4 commits into from
Jul 27, 2024

Conversation

Andrew-Dickinson
Copy link
Member

Integrates a bulk import library to allow bulk import and export of objects. Our tables with custom primary key values need a slight customization, but nothing too bad

https://github.com/django-import-export/django-import-export

Tested export/import to/from CSV

Closes #201

@WillNilges
Copy link
Collaborator

I thought that Django already had some kind of built in import/export tool. Do we really need to add another dependency?

https://docs.djangoproject.com/en/5.0/ref/django-admin/#dumpdata

https://docs.djangoproject.com/en/5.0/ref/django-admin/#loaddata

@Andrew-Dickinson
Copy link
Member Author

Those commands only allow you to export/replace large chunks of data like entire tables, and require CLI access and knowledge. This is a totally different use case?

Read the slack thread linked in the issue please

@WillNilges
Copy link
Collaborator

Sorry, I thought that loaddata might be sufficient for this usecase, but if it's not, it's not. Let me take a look at the PR.

Copy link
Collaborator

@WillNilges WillNilges left a comment

Choose a reason for hiding this comment

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

Seems reasonable. Can you add some docs on how to use it to the README?

Comment on lines +16 to +17
if "install_number" not in dataset.headers:
dataset.headers.append("install_number")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just out of curiosity, why this is necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

IIRC this is due to our custom primary key setup. Something about the lack of auto increment

@Andrew-Dickinson
Copy link
Member Author

I think the wiki is a better place for docs, since this is end-user focused not dev focused. But yeah I can write something up

@Andrew-Dickinson Andrew-Dickinson enabled auto-merge (squash) July 27, 2024 18:26
@Andrew-Dickinson Andrew-Dickinson merged commit 2a0a14d into main Jul 27, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

Admins Need the Ability to "Bulk Create" install & member entries for large buildings
2 participants