Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running python manage.py bill_data #48

Closed
aih opened this issue Nov 11, 2020 · 2 comments
Closed

Error running python manage.py bill_data #48

aih opened this issue Nov 11, 2020 · 2 comments
Assignees

Comments

@aih
Copy link
Collaborator

aih commented Nov 11, 2020

Entering directory: /Users/arihershowitz/Documents/workspace/FlatGovDir/FlatGov/server_py/flatgov/congress/data/116/bills/sconres/sconres47
Traceback (most recent call last):
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/query.py", line 573, in get_or_create
    return self.get(**kwargs), False
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/query.py", line 431, in get
    self.model._meta.object_name
bills.models.DoesNotExist: Bill matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.StringDataRightTruncation: value too long for type character varying(500)


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

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/Users/arihershowitz/Documents/workspace/FlatGovDir/FlatGov/server_py/flatgov/common/management/commands/bill_data.py", line 26, in handle
    updateBillsMeta()
  File "/Users/arihershowitz/Documents/workspace/FlatGovDir/FlatGov/server_py/flatgov/common/billdata.py", line 255, in updateBillsMeta
    walkBillDirs(processFile=addToBillsMeta)
  File "/Users/arihershowitz/Documents/workspace/FlatGovDir/FlatGov/server_py/flatgov/common/billdata.py", line 67, in walkBillDirs
    processFile(dirName=dirName, fileName=fname)
  File "/Users/arihershowitz/Documents/workspace/FlatGovDir/FlatGov/server_py/flatgov/common/billdata.py", line 248, in addToBillsMeta
    defaults=bill_data
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/query.py", line 576, in get_or_create
    return self._create_object_from_params(kwargs, params)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/query.py", line 610, in _create_object_from_params
    obj = self.create(**params)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/query.py", line 447, in create
    obj.save(force_insert=True, using=self.db)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/base.py", line 751, in save
    force_update=force_update, update_fields=update_fields)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/base.py", line 789, in save_base
    force_update, using, update_fields,
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/base.py", line 892, in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/base.py", line 932, in _do_insert
    using=using, raw=raw,
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/query.py", line 1249, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1395, in execute_sql
    cursor.execute(sql, params)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/Users/arihershowitz/.pyenv/versions/flatgov/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.DataError: value too long for type character varying(500)
@aih
Copy link
Collaborator Author

aih commented Nov 11, 2020

I did not re-run fetch_data, so it's possible that there is a difference in the dataset that I have.

@weinicookpad
Copy link

The issue occurs due to the max length of the field.
At this point, Titles and Titles Whole Bill fields are json fields.
So it's resolved.

@aih aih closed this as completed Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants