[Django] #30813: dumpdata > flush > loaddata

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #30813: dumpdata > flush > loaddata

Django
#30813: dumpdata > flush > loaddata
-------------------------------------+-------------------------------------
               Reporter:  Maksych    |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Component:  Core       |        Version:  2.2
  (Management commands)              |
               Severity:  Normal     |       Keywords:
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 After commands:
 > python manage.py dumpdata > db.json
 > python manage.py loaddata db.json
 All it`s okay, but after:
 > python manage.py flush
 > python manage.py loaddata db.json
 Have exception:
 > django.db.utils.IntegrityError: Problem installing fixture
 'D:\projects\python\django\ultrashop_backend\db.json': Could not load
 contenttypes.ContentType

--
Ticket URL: <https://code.djangoproject.com/ticket/30813>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.801defecf82bf0a5b416334f741d9f3a%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30813: dumpdata > flush > loaddata

Django
#30813: dumpdata > flush > loaddata
-------------------------------------+-------------------------------------
     Reporter:  Maksych              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  Core (Management     |                  Version:  2.2
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Maksych):

 * Attachment "photo_2019-09-27_18-12-35.jpg" added.


--
Ticket URL: <https://code.djangoproject.com/ticket/30813>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.7c99a8f57e7fb7fa61b2c1ad2de01aaa%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30813: dumpdata > flush > loaddata. (was: dumpdata > flush > loaddata)

Django
In reply to this post by Django
#30813: dumpdata > flush > loaddata.
-------------------------------------+-------------------------------------
     Reporter:  Maksych              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by felixxm):

 * status:  new => closed
 * version:  2.2 => master
 * resolution:   => invalid


Comment:

 `dumpdata` dumps primary keys by default which don't exist anymore after
 `flush`, so it's expected that such combination of commands fails. You
 should try:
 {{{
 django-admin dumpdata  --natural-foreign --natural-primary
 }}}
 to avoid dumping auto primary keys (see
 [https://docs.djangoproject.com/en/2.2/ref/django-admin/#dumpdata
 documentation]).

 Closing per TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/30813#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.82c505f0a1a582fa0c490565b14aa836%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30813: dumpdata > flush > loaddata.

Django
In reply to this post by Django
#30813: dumpdata > flush > loaddata.
-------------------------------------+-------------------------------------
     Reporter:  Maksych              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Maksych):

 No, I tell about:
 > python manage.py flush

 My full actions:
 > django-admin startproject project .
 > python manage.py makemigrations
 > python manage.py migrate
 > python manage.py dumpdata > db.json
 > python manage.py loaddata db.json
 And all it's okay, but after:
 > python manage.py flush
 > python manage.py loaddata db.json
 Raised exception because content-types after flush is diferent betwen
 after migrate.

--
Ticket URL: <https://code.djangoproject.com/ticket/30813#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.860870626902f479d8bf33ba84edf2e9%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30813: dumpdata > flush > loaddata.

Django
In reply to this post by Django
#30813: dumpdata > flush > loaddata.
-------------------------------------+-------------------------------------
     Reporter:  Maksych              |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Core (Management     |                  Version:  master
  commands)                          |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by felixxm):

 This is documented behavior, please take a look at
 [https://docs.djangoproject.com/en/2.2/ref/django-admin/#flush flush
 documentation]:

 > Removes all data from the database and **re-executes any post-
 synchronization handlers**. The table of which migrations have been
 applied is not cleared. If you would rather start from an empty database
 and re-run all migrations, **you should drop and recreate the database**
 and then run migrate instead.

 so `flush` removes all data from the database and **re-executes post-
 synchronization handlers** which recreates `ContentType`'s with different
 IDs.

--
Ticket URL: <https://code.djangoproject.com/ticket/30813#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

--
You received this message because you are subscribed to the Google Groups "Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.76293f8881ddaea466469d8a9bdb0609%40djangoproject.com.