jwjacobson / jazztunes

a jazz repertoire management app
https://jazztunes.org
GNU General Public License v3.0
3 stars 0 forks source link

need to update django fixture #192

Closed bbelderbos closed 5 months ago

bbelderbos commented 5 months ago
django.core.serializers.base.DeserializationError: Problem installing fixture '/app/tune/fixtures/newest_dump.json':

this was due to db schema change, @jwjacobson please update the fixture and try to rerun it on your end:

# 1. add the heroku remote
$ git remote add heroku https://git.heroku.com/jazz-repertoire.git
# 2. run the fixture
$ heroku run python manage.py loaddata tune/fixtures/newest_dump.json

(install the heroku toolbelt first)

jwjacobson commented 5 months ago

Running into some trouble with this, I'm sure that everything is migrated to the most recent version of the model which no longer includes the is_ballad field which is throwing the error. is_ballad is not part of the model or in the fixture, so what part of the code could be looking for it?

 Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.12/site-packages/django/db/models/options.py", line 681, in get_field
    return self.fields_map[field_name]
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'is_ballad'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/serializers/json.py", line 70, in Deserializer
    yield from PythonDeserializer(objects, **options)
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/serializers/python.py", line 141, in Deserializer
    field = Model._meta.get_field(field_name)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.12/site-packages/django/db/models/options.py", line 683, in get_field
    raise FieldDoesNotExist(
django.core.exceptions.FieldDoesNotExist: Tune has no field named 'is_ballad'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/manage.py", line 23, in <module>
    main()
  File "/app/manage.py", line 19, in main
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/management/commands/loaddata.py", line 102, in handle
    self.loaddata(fixture_labels)
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/management/commands/loaddata.py", line 163, in loaddata
    self.load_label(fixture_label)
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/management/commands/loaddata.py", line 251, in load_label
    for obj in objects:
  File "/app/.heroku/python/lib/python3.12/site-packages/django/core/serializers/json.py", line 74, in Deserializer
    raise DeserializationError() from exc
django.core.serializers.base.DeserializationError: Problem installing fixture '/app/tune/fixtures/newest_dump.json': 
bbelderbos commented 5 months ago

If you have the data in your local test db (which is fully migrated), can you make the fixture with the dumpdata switch of manage.py?

jwjacobson commented 5 months ago

yes. that is how I make it, with

python manage.py dumpdata > tune/fixtures/newest_dump.json 

the above is the output to

heroku run python manage.py loaddata tune/fixtures/newest_dump.json
jwjacobson commented 5 months ago

nevermind got it working

bbelderbos commented 5 months ago

sweet, what was the fix? so now you have data running in your app on heroku? share a win in pdm circle?

jwjacobson commented 5 months ago

I pushed to main and redeployed to heroku. I guess maybe the version you originally deployed was old enough still to have that field?