FPbase icon indicating copy to clipboard operation
FPbase copied to clipboard

Broken sample data

Open rsenft1 opened this issue 3 years ago • 3 comments

Hi Talley,

I was trying to load the sample data and got the following error:

Traceback (most recent call last):
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\backends\utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.StringDataRightTruncation: value too long for type character varying(5)


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

Traceback (most recent call last):
  File "manage.py", line 32, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\core\management\base.py", line 369, in execute
    output = self.handle(*args, **options)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\core\management\commands\loaddata.py", line 72, in handle
    self.loaddata(fixture_labels)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\core\management\commands\loaddata.py", line 114, in loaddata
    self.load_label(fixture_label)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\core\management\commands\loaddata.py", line 181, in load_label
    obj.save(using=self.using)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\core\serializers\base.py", line 223, in save
    models.Model.save_base(self.object, using=using, raw=True, **kwargs)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\models\base.py", line 782, in save_base
    updated = self._save_table(
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\models\base.py", line 864, in _save_table
    updated = self._do_update(base_qs, using, pk_val, values, update_fields,
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\models\base.py", line 917, in _do_update
    return filtered._update(values) > 0
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\models\query.py", line 771, in _update
    return query.get_compiler(self.db).execute_sql(CURSOR)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\models\sql\compiler.py", line 1500, in execute_sql
    cursor = super().execute_sql(result_type)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\models\sql\compiler.py", line 1152, in execute_sql
    cursor.execute(sql, params)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\backends\utils.py", line 100, in execute
    return super().execute(sql, params)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\backends\utils.py", line 68, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\backends\utils.py", line 77, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\backends\utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "C:\Users\Rebecca\anaconda3\envs\fpbase\lib\site-packages\django\db\backends\utils.py", line 86, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.DataError: Problem installing fixture 'C:\Users\Rebecca\Documents\GitHub\FPbase\fixtures\testdata.json.gz': Could not load proteins.Protein(pk=1): value too long for type character varying(5)

It seems like some field is set to be too short. Is this something I can change on my end by changing something about the database parameters (very very new to postgresql, but willing to learn)? Or is this something about the sample data itself? Or perhaps that I'm running on Windows? Any help would be greatly appreciated. Thanks!

rsenft1 avatar Jul 09 '22 22:07 rsenft1

hey @rsenft1! You might be the first person to actually try to test this stuff locally... ever?

It's true, that fixture is probably ancient at this point, and no longer consistent with the database schema, and I should update/remove those docs. Maybe we could zoom sometime soon to discuss what your ultimate aim is here? I'm more than happy to help get the tests working for you locally if you are just interested in learning how it works, but also happy to just get you more directly to whatever goal motivated you to try this in the first place :)

Will ping offline

tlambert03 avatar Jul 09 '22 22:07 tlambert03

actually... can you email me? :) can't quickly locate your email.

tlambert03 avatar Jul 09 '22 22:07 tlambert03

Sounds good, will email! :)

rsenft1 avatar Jul 09 '22 23:07 rsenft1