Bug #7739
GMN Django models need to be adjusted for var char content greater than 1024 character length
0%
Description
Inserting content in GMN database tables fail when string content exceeds 1024 length.
A specific example occurs with the mn_systemmetadatarfreshqueuestatus.status field, which is set to status = models.CharField(max_length=1024, unique=True). An exception occurs when setting the status field to a string with length greater than 1024:
Traceback (most recent call last):
File "./manage.py", line 31, in
execute_from_command_line(sys.argv)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(args, **options.dict)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(options)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/service/mn/management/commands/process_system_metadata_refresh_queue.py", line 121, in
handle_noargs
p.process_refresh_queue()
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/service/mn/management/commands/process_system_metadata_refresh_queue.py", line 153, in
process_refresh_queue
self._process_refresh_task(task)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/service/mn/management/commands/process_system_metadata_refresh_queue.py", line 164, in
_process_refresh_task
self._gmn_refresh_task_update(task, str(e))
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/service/mn/management/commands/process_system_metadata_refresh_queue.py", line 181, in
_gmn_refresh_task_update
task.set_status(status)
File "/var/local/dataone/gmn/lib/python2.7/site-packages/service/mn/models.py", line 198, in set_status
get_or_create(status=status)[0]
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/manager.py", line 154, in get_or_create
return self.get_queryset().get_or_create(*kwargs)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/query.py", line 388, in get_or_create
six.reraise(*exc_info)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/query.py", line 380, in get_or_create
obj.save(force_insert=True, using=self.db)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/base.py", line 545, in save
force_update=force_update, update_fields=update_fields)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/base.py", line 573, in save_base
updated = self.save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/base.py", line 654, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/base.py", line 687, in _do_insert
using=using, raw=raw)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/manager.py", line 232, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/query.py", line 1511, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 898, in execute_sql
cursor.execute(sql, params)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit_
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/var/local/dataone/gmn/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
return self.cursor.execute(sql, params)
django.db.utils.DataError: value too long for type character varying(1024)
History
#1 Updated by Mark Servilla over 8 years ago
- Tracker changed from Task to Bug