azavea / climate-change-api

Apache License 2.0
0 stars 0 forks source link

Error loading historical data fixture #157

Open CloudNiner opened 7 years ago

CloudNiner commented 7 years ago
vagrant@vagrant-ubuntu-trusty-64:~/climate-change-api$ ./scripts/console django './manage.py loaddata historic_averages historic_baselines'
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 60, in handle
    self.loaddata(fixture_labels)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 100, in loaddata
    self.load_label(fixture_label)
  File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 152, in load_label
    for obj in objects:
  File "/usr/local/lib/python2.7/site-packages/django/core/serializers/json.py", line 85, in Deserializer
    six.reraise(DeserializationError, DeserializationError(e), sys.exc_info()[2])
  File "/usr/local/lib/python2.7/site-packages/django/core/serializers/json.py", line 79, in Deserializer
    for obj in PythonDeserializer(objects, **options):
  File "/usr/local/lib/python2.7/site-packages/django/core/serializers/python.py", line 165, in Deserializer
    raise base.DeserializationError.WithData(e, d['model'], d.get('pk'), field_value)
django.core.serializers.base.DeserializationError: Problem installing fixture '/opt/django/climate_change_api/climate_data/fixtures/historic_averages.json.gz': ClimateDataCell matching query does not exist.: (climate_data.historicaverageclimatedata:pk=No
ne) field_value was '[u'39.875', u'277.125']'
vagrant@vagrant-ubuntu-trusty-64:~/climate-change-api$

Steps to reproduce:

rmartz commented 7 years ago

The fixtures need a bit of tinkering, Django expects them to represent an initial configuration of sorts so they're not flexible for different configurations (You must have the map cells for all of the 200 cities config imported). The documentation is definitely wrong, right now I think the workflow is you have to import the cities, then do import_from_other_instance to make the map cells (😬), then import from the fixtures. We could bundle cities and map_cells with the historic data but those change more often and the historic data fixture is already pretty huge.

CloudNiner commented 7 years ago

If we wanted to fix this, what would a sensible series of tasks look like?