Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jpablo/django-bulk-insert

Bulk insert django objects into mysql databases
https://github.com/jpablo/django-bulk-insert

Last synced: 10 days ago
JSON representation

Bulk insert django objects into mysql databases

Awesome Lists containing this project

README

        

# Mysql Bulk Insert

Bulk-inserts django objects by generating the sql as text and using cursor.execute()

## Example usage:

```python
from mysql_bulk_insert import bulk_insert
objects = [o1,o2,o3,...]
bulk_insert(objects)
```

If you want to inspect the generated sql instead:

```python
bulk_insert(objects, show_sql=True)
```

## limitations

bulk_insert doesn't follow references to other models.
It just outputs the foreign key.
If you have a hierarchy of objects, you need to save each group of objects in the correct order.
(Or submit a patch :) )

bulk_insert only knows about mysql.

Cheers!