https://github.com/jpablo/django-bulk-insert
Bulk insert django objects into mysql databases
https://github.com/jpablo/django-bulk-insert
Last synced: 4 months ago
JSON representation
Bulk insert django objects into mysql databases
- Host: GitHub
- URL: https://github.com/jpablo/django-bulk-insert
- Owner: jpablo
- Created: 2011-06-28T23:38:43.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-06-29T22:02:56.000Z (almost 15 years ago)
- Last Synced: 2025-07-13T08:47:45.359Z (11 months ago)
- Homepage:
- Size: 93.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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!