opendatateam/udata

Error when creating sample data with `udata init`

streino opened this issue · 1 comments

$ docker exec -it docker-udata-udata-1 udata --version
3.3.2

$ docker exec -it docker-udata-udata-1 udata init
...
Do you want to create some sample data? [Y/n]: y
Traceback (most recent call last):
  File "/usr/local/bin/udata", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/udata/commands/__init__.py", line 248, in main
    return super(UdataGroup, self).main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 586, in main
    return super(FlaskGroup, self).main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 426, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/udata/commands/init.py", line 44, in init
    ctx.invoke(generate_fixtures)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/flask/cli.py", line 426, in decorator
    return __ctx.invoke(f, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/udata/commands/fixtures.py", line 125, in generate_fixtures
    dataset = DatasetFactory(**fixture['dataset'], organization=org)
  File "/usr/local/lib/python3.7/site-packages/factory/base.py", line 46, in __call__
    return cls.create(**kwargs)
  File "/usr/local/lib/python3.7/site-packages/factory/base.py", line 564, in create
    return cls._generate(enums.CREATE_STRATEGY, kwargs)
  File "/usr/local/lib/python3.7/site-packages/factory/base.py", line 501, in _generate
    return step.build()
  File "/usr/local/lib/python3.7/site-packages/factory/builder.py", line 279, in build
    kwargs=kwargs,
  File "/usr/local/lib/python3.7/site-packages/factory/base.py", line 315, in instantiate
    return self.factory._create(model, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/factory/mongoengine.py", line 26, in _create
    instance = model_class(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/mongoengine/base/document.py", line 99, in __init__
    raise FieldDoesNotExist(msg)
mongoengine.errors.FieldDoesNotExist: The fields "{'created_at_internal', 'harvest'}" do not exist on the document "Dataset"

J'obtiens l'erreur ci-dessus en utilisant le docker compose de https://github.com/opendatateam/docker-udata.
L'init fonctionne lorsque j'exécute python manage.py init depuis le répo opendatateam/udata.

A priori c'est la version udata dans opendatateam/docker-udata qui est trop vieille :

udata

python manage.py --version
6.1.7.dev0

docker-udata

docker exec -it docker-udata-udata-1 udata --version
3.3.2

Il faudrait plutôt déplacer ce ticket dans opendatateam/docker-udata mais je n'ai pas les droits.