A new feature imported from Berlin

Python wrapper on PostgreSQL’s power COPY command now supports file objects

Today the California Civic Data Coalition released a new version of django-postgres-copy, an open-source software library that quickly loads large pools of data into PostgreSQL databases.

Jonathan Sundqvist
Jonathan Sundqvist

It includes a new feature contributed by Jonathan Sundqvist in Berlin, Germany. Thanks to Sundqvist’s work, our bulk loader is no longer limited to files stored on your local filesystem. Python file objects, which can be concocted entirely in memory, can now be loaded just as easily.

This easily, in fact:

MyModel.objects.from_csv(file_obj)

Unlike our team, Sundqvist doesn’t work in journalism. He works for a company called Zageno that sells biotechnology products online.

“The dataset consists of products, their variants and prices,” Sundqvist said. “There is probably 1 million of those products on the site at the moment. So when updates need to happen or new products are added speed is invaluable. Using this library will help in cleaning up some of that code.”

Zageno

In our view, this collaboration reaffirms how open-source techniques allow developers in different fields to benefit from each other’s efforts. He is the latest in a line of developers outside journalism who has contributed to django-postgres-copy.

Check out Sundqvists’s changes and learn more about django-postgres-copy in the official documentation.

If there are changes you’d like to see, go get involved on our GitHub repository.