Skip to content

Instantly share code, notes, and snippets.

@axilaris
Created March 5, 2024 19:59
Show Gist options
  • Save axilaris/123516cdc9023dc02ebac3cba6644dd7 to your computer and use it in GitHub Desktop.
Save axilaris/123516cdc9023dc02ebac3cba6644dd7 to your computer and use it in GitHub Desktop.
% python manage.py shell
Python 3.11.5 (main, Aug 24 2023, 15:09:45) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from simple.models import Simpletable
>>> a = Simpletable.objects.all()
>>> a
Traceback (most recent call last):
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
psycopg2.errors.UndefinedColumn: column simpletable.id does not exist
LINE 1: SELECT "simpletable"."id", "simpletable"."name", "simpletabl...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/models/query.py", line 370, in __repr__
data = list(self[: REPR_OUTPUT_SIZE + 1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/models/query.py", line 394, in __iter__
self._fetch_all()
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/models/query.py", line 1867, in _fetch_all
self._result_cache = list(self._iterable_class(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/models/query.py", line 87, in __iter__
results = compiler.execute_sql(
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/models/sql/compiler.py", line 1398, in execute_sql
cursor.execute(sql, params)
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
with self.db.wrap_database_errors:
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/ax/Documents/project/simple/x/test_env/lib/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.ProgrammingError: column simpletable.id does not exist
LINE 1: SELECT "simpletable"."id", "simpletable"."name", "simpletabl...
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment