Django 2.2.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 2915 页 | 2.83 MB | 1 年前3
Django 2.2.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 2060 页 | 7.23 MB | 1 年前3
Django 3.0.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 3085 页 | 2.95 MB | 1 年前3
Django 4.0.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 2248 页 | 7.90 MB | 1 年前3
Django 3.2.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 2199 页 | 7.89 MB | 1 年前3
Django 3.0.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 2002 页 | 6.73 MB | 1 年前3
Django 3.1.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 2053 页 | 6.92 MB | 1 年前3
Django 4.2.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 3305 页 | 3.16 MB | 1 年前3
Django 4.1.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 3240 页 | 3.13 MB | 1 年前3
Django 4.0.x DocumentationRunPython. Here’s an example of a non-atomic data migration that updates a large table in smaller batches: import uuid from django.db import migrations, transaction def gen_uuid(apps, schema_editor): objects with a manually set primary key can be inserted first. If you want to insert objects in batches without evaluating the entire generator at once, you can use this technique as long as the objects the database adapter using the fetchmany() method defined in PEP 249. SQLite can fetch results in batches using fetchmany(), but since SQLite doesn’t provide isolation between queries within a connection0 码力 | 3184 页 | 3.14 MB | 1 年前3
共 28 条
- 1
- 2
- 3













