Skip to content

Agent CSV export/import#287

Draft
lukavdplas wants to merge 5 commits into
developfrom
feature/agent-export
Draft

Agent CSV export/import#287
lukavdplas wants to merge 5 commits into
developfrom
feature/agent-export

Conversation

@lukavdplas

Copy link
Copy Markdown
Contributor

close #270

@XanderVertegaal XanderVertegaal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I love the export script with attrgetter() - very neat! 👌

I left a few comments with the import script, which may need a bit more work.

Comment thread backend/person/management/commands/export_agents.py
Comment thread backend/person/management/commands/import_agents.py
Comment thread backend/person/management/commands/import_agents.py Outdated
Comment thread backend/person/management/commands/export_agents.py Outdated
data = {
col: get(attr)(agent) for col, attr in export_fields
}
writer.writerow(data)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

With my automatically generated test dataset, I see a number of duplicates:

id,name,description,source_id,source_name,historical_person
...
512,Quods,,4,Modi sit voluptate.,Rachael White-Fowler
512,Quods,,4,Modi sit voluptate.,Rachael White-Fowler
512,Quods,,4,Modi sit voluptate.,Rachael White-Fowler
512,Quods,,4,Modi sit voluptate.,Rachael White-Fowler
512,Quods,,4,Modi sit voluptate.,Rachael White-Fowler
515,Quaes,,1,Ut dolor accusantium earum.,Mr Terence Jones
515,Quaes,,1,Ut dolor accusantium earum.,Mr Terence Jones
515,Quaes,,1,Ut dolor accusantium earum.,Mr Terence Jones
...

In total my CSV has 1506 lines, but I only have 801 AgentDescription rows in my DB.

I'm not sure what causes this, but it is something to check.

@lukavdplas

Copy link
Copy Markdown
Contributor Author

For the record, I did not yet fix the duplicate problem as I've not been able to reproduce it. Let's look at this together some time.

I think this PR is low-priority right now anyway, so we can see when we get around to that.

@lukavdplas
lukavdplas marked this pull request as draft May 27, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Import/export for agent data

2 participants