django-bulk-copy-0.1.3
توضیحات
Faster way to create your models in Django
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | django-bulk-copy-0.1.3 |
| نام | django-bulk-copy |
| نسخه کتابخانه | 0.1.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Ahmet Burak |
| ایمیل نویسنده | Ahmet Burak Ozyurt <ahmetbozyurtt@gmail.com> |
| آدرس صفحه اصلی | https://github.com/ahmetveburak/django-bulk-copy |
| آدرس اینترنتی | https://pypi.org/project/django-bulk-copy/ |
| مجوز | MIT |
# Django Bulk Copy
Create your mass data in a faster way with the `COPY` command.
> Currently it supports only the Postgresql database.
### Install
`pip install django-bulk-copy`
### Usage
```python
class TestModel(models.Model):
integer_field = models.IntegerField(null=True)
char_field = models.CharField(max_length=32, null=True)
boolean_field = models.BooleanField(default=False)
datetime_field = models.DateTimeField(null=True)
json_field = models.JSONField(null=True)
```
```python
from bulk_copy import BulkCopy
objects = [
TestModel(
integer_field=i,
char_field=str(i),
boolean_field=bool(i % 2),
datetime_field=timezone.now(),
json_field={i: f"{i:>09}"},
)
for i in range(1000)
]
BulkCopy(objects)
```
BulkCopy only uses the initial time of the transaction if your model has a date/datetime field with `auto_now=True`.
##### Additional
If you need to create your models from a csv file, [django-postgres-copy](https://palewi.re/docs/django-postgres-copy/) could be a better alternative.
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl django-bulk-copy-0.1.3:
pip install django-bulk-copy-0.1.3.whl
نصب پکیج tar.gz django-bulk-copy-0.1.3:
pip install django-bulk-copy-0.1.3.tar.gz