Open aliakbarhamzeh1378 opened 3 years ago
I encountered a similar error and found the solution was to install sqlparse 0.2.4
pip3 install sqlparse==0.2.4
https://github.com/nesdis/djongo/issues/156#issuecomment-472250921
I haven't needed to run migrations when using Djongo though. The console shows errors but they don't affect the application.
The issue is in the file sql2mongo/query.py:560
under the function _add
elif tok.match(tokens.Name.Builtin, ( 'integer', 'bool', 'char', 'date', 'boolean', 'datetime', 'float', 'time', 'number', 'string' )):
It only handle integer when django send "int" and "float", it just need to be added here.
Hope there will be a quick fix release
fixed in this PR #474
I executed this command and it works python manage.py migrate --fake article 0001_initial
Here - Article is django apps and 0001_initial is article migrations
I am using djongo 1.3.3 with Django 3.1.1 and running MongoDB 4.4.0 on mac and ubuntu 20 this command worked:
python manage.py makemigrations
but when I run this command :python manage.py migrate
that show me this error:Operations to perform: Apply all migrations: admin, api, auth, contenttypes, sessions Running migrations: This version of djongo does not support "NULL, NOT NULL column validation check" fully. Visit https://www.patreon.com/nesdis Applying contenttypes.0001_initial...This version of djongo does not support "schema validation using CONSTRAINT" fully. Visit https://www.patreon.com/nesdis OK Applying auth.0001_initial...This version of djongo does not support "schema validation using KEY" fully. Visit https://www.patreon.com/nesdis This version of djongo does not support "schema validation using REFERENCES" fully. Visit https://www.patreon.com/nesdis OK Applying admin.0001_initial... OK Applying admin.0002_logentry_remove_auto_add... OK Applying admin.0003_logentry_add_action_flag_choices... OK Not implemented alter command for SQL ALTER TABLE "api_admodel" ADD COLUMN "category_id" int DEFAULT %(0)s NOT NULL Applying api.0001_initial...Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/cursor.py", line 56, in execute params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/sql2mongo/query.py", line 783, in __init__ self._query = self.parse() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/sql2mongo/query.py", line 875, in parse raise e File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/sql2mongo/query.py", line 856, in parse return handler(self, statement) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/sql2mongo/query.py", line 888, in _alter query = AlterQuery(self.db, self.connection_properties, sm, self._params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/sql2mongo/query.py", line 425, in __init__ super().__init__(*args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/sql2mongo/query.py", line 84, in __init__ super().__init__(*args) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/sql2mongo/query.py", line 62, in __init__ self.parse() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/sql2mongo/query.py", line 435, in parse self._add(statement) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/sql2mongo/query.py", line 599, in _add err_sub_sql=statement) djongo.exceptions.SQLDecodeError: Keyword: int Sub SQL: ALTER TABLE "api_admodel" ADD COLUMN "category_id" int DEFAULT %(0)s NOT NULL FAILED SQL: ('ALTER TABLE "api_admodel" ADD COLUMN "category_id" int DEFAULT %(0)s NOT NULL',) Params: ([[]],) Version: 1.3.3 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/cursor.py", line 59, in execute raise db_exe from e djongo.database.DatabaseError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line utility.execute() File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 328, in run_from_argv self.execute(*args, **cmd_options) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 369, in execute output = self.handle(*args, **options) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/base.py", line 83, in wrapped res = handle_func(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/core/management/commands/migrate.py", line 233, in handle fake_initial=fake_initial, File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/executor.py", line 245, in apply_migration state = migration.apply(state, schema_editor) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/migration.py", line 124, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/migrations/operations/fields.py", line 112, in database_forwards field, File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 480, in add_field self.execute(sql, params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/base/schema.py", line 142, in execute cursor.execute(sql, params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute return super().execute(sql, params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute_with_wrappers return executor(sql, params, many, context) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute return self.cursor.execute(sql, params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/djongo/cursor.py", line 59, in execute raise db_exe from e django.db.utils.DatabaseError
how can I fix it?
Hey, did you find any solution to this problem?
I am also facing this issue with djongo.exceptions.SQLDecodeError: sqlparse version:- 0.2.4
Keyword: Unknown token: TYPE
Sub SQL: None
FAILED SQL: ('ALTER TABLE "Account_auditlogs" ALTER COLUMN "session_id" TYPE int',)
Params: ([],)
Version: 1.3.6
Is there any update or fix for this.
Is there any update or fix for this.
i was also a bit stuck and am using django 4.1 and @elliotsyoung answer still works
Hey everyone, I also faced similar issues while working with the djongo engine. Installing the pymongo == 3.12.3 exactly resolved it for me. Hope it helps you too.
Apply all migrations: accounts, admin, auth, contenttypes, django_celery_beat, django_celery_results, pvcell, sessions
Running migrations:
Applying django_celery_results.0006_taskresult_date_created...Traceback (most recent call last):
File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 824, in parse
return handler(self, statement)
File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 953, in _update
self._query = UpdateQuery(self.db, self.connection_properties, sm, self._params)
File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 309, in init
super().init(*args)
File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 72, in init
self.parse()
File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 339, in parse
kwargs.update(self.set_columns.to_mongo())
File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\converters.py", line 348, in to_mongo
'$set': {
File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\converters.py", line 350, in
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Internship-Django\projects\solar\manage.py", line 22, in
execute_from_command_line(sys.argv)
File "D:\Internship-Django\venv\lib\site-packages\django\core\management__init__.py", line 381, in execute_from_command_line
utility.execute()
File "D:\Internship-Django\venv\lib\site-packages\django\core\management__init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\Internship-Django\venv\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
self.execute(*args, cmd_options)
File "D:\Internship-Django\venv\lib\site-packages\django\core\management\base.py", line 364, in execute
output = self.handle(*args, *options)
File "D:\Internship-Django\venv\lib\site-packages\django\core\management\base.py", line 83, in wrapped
res = handle_func(args, kwargs)
File "D:\Internship-Django\venv\lib\site-packages\django\core\management\commands\migrate.py", line 232, in handle
post_migrate_state = executor.migrate(
File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\executor.py", line 245, in apply_migration
state = migration.apply(state, schema_editor)
File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\migration.py", line 121, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\operations\special.py", line 190, in database_forwards
self.code(from_state.apps, schema_editor)
File "D:\Internship-Django\venv\lib\site-packages\django_celery_results\migrations\0006_taskresult_date_created.py", line 14, in copy_date_done_to_date_created
TaskResult.objects.using(db_alias).all().update(
File "D:\Internship-Django\venv\lib\site-packages\django\db\models\query.py", line 741, in update
rows = query.get_compiler(self.db).execute_sql(CURSOR)
File "D:\Internship-Django\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1471, in execute_sql
cursor = super().execute_sql(result_type)
File "D:\Internship-Django\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1142, in execute_sql
cursor.execute(sql, params)
File "D:\Internship-Django\venv\lib\site-packages\django\db\backends\utils.py", line 99, in execute
return super().execute(sql, params)
File "D:\Internship-Django\venv\lib\site-packages\django\db\backends\utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "D:\Internship-Django\venv\lib\site-packages\django\db\backends\utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "D:\Internship-Django\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "D:\Internship-Django\venv\lib\site-packages\djongo\cursor.py", line 48, in execute
self.result = Result(
File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 753, in init__
self.parse()
File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 846, in parse
raise exe from e
djongo.sql2mongo.SQLDecodeError: FAILED SQL: UPDATE "django_celery_results_taskresult" SET "date_created" = "django_celery_results_taskresult"."date_done"
Params: ()
Version: 1.3.1
I am facing this type of issue anyone solved this problem
Apply all migrations: accounts, admin, auth, contenttypes, django_celery_beat, django_celery_results, pvcell, sessions Running migrations: Applying django_celery_results.0006_taskresult_date_created...Traceback (most recent call last): File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 824, in parse return handler(self, statement) File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 953, in _update self._query = UpdateQuery(self.db, self.connection_properties, sm, self._params) File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 309, in init super().init(*args) File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 72, in init self.parse() File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 339, in parse kwargs.update(self.set_columns.to_mongo()) File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\converters.py", line 348, in to_mongo '$set': { File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\converters.py", line 350, in if sql.rhs_indexes is not None else None File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongoinit.py", line 200, in rhs_indexes raise SQLDecodeError djongo.sql2mongo.SQLDecodeError
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "D:\Internship-Django\projects\solar\manage.py", line 22, in main() File "D:\Internship-Django\projects\solar\manage.py", line 18, in main execute_from_command_line(sys.argv) File "D:\Internship-Django\venv\lib\site-packages\django\core\managementinit.py", line 381, in execute_from_command_line utility.execute() File "D:\Internship-Django\venv\lib\site-packages\django\core\managementinit.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "D:\Internship-Django\venv\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv self.execute(*args, cmd_options) File "D:\Internship-Django\venv\lib\site-packages\django\core\management\base.py", line 364, in execute output = self.handle(*args, *options) File "D:\Internship-Django\venv\lib\site-packages\django\core\management\base.py", line 83, in wrapped res = handle_func(args, kwargs) File "D:\Internship-Django\venv\lib\site-packages\django\core\management\commands\migrate.py", line 232, in handle post_migrate_state = executor.migrate( File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial) File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\executor.py", line 245, in apply_migration state = migration.apply(state, schema_editor) File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\migration.py", line 121, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "D:\Internship-Django\venv\lib\site-packages\django\db\migrations\operations\special.py", line 190, in database_forwards self.code(from_state.apps, schema_editor) File "D:\Internship-Django\venv\lib\site-packages\django_celery_results\migrations\0006_taskresult_date_created.py", line 14, in copy_date_done_to_date_created TaskResult.objects.using(db_alias).all().update( File "D:\Internship-Django\venv\lib\site-packages\django\db\models\query.py", line 741, in update rows = query.get_compiler(self.db).execute_sql(CURSOR) File "D:\Internship-Django\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1471, in execute_sql cursor = super().execute_sql(result_type) File "D:\Internship-Django\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1142, in execute_sql cursor.execute(sql, params) File "D:\Internship-Django\venv\lib\site-packages\django\db\backends\utils.py", line 99, in execute return super().execute(sql, params) File "D:\Internship-Django\venv\lib\site-packages\django\db\backends\utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "D:\Internship-Django\venv\lib\site-packages\django\db\backends\utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "D:\Internship-Django\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "D:\Internship-Django\venv\lib\site-packages\djongo\cursor.py", line 48, in execute self.result = Result( File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 753, in init self.parse() File "D:\Internship-Django\venv\lib\site-packages\djongo\sql2mongo\query.py", line 846, in parse raise exe from e djongo.sql2mongo.SQLDecodeError: FAILED SQL: UPDATE "django_celery_results_taskresult" SET "date_created" = "django_celery_results_taskresult"."date_done" Params: () Version: 1.3.1
I am facing this type of issue anyone solved this problem
Can you please share some specifics of the library versions or the req.txt file for the pip freeze?
Traceback (most recent call last):
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\djongo\sql2mongo\query.py", line 808, in __iter__
yield from iter(self._query)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\djongo\sql2mongo\query.py", line 166, in __iter__
for doc in cursor:
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\pymongo\cursor.py", line 1238, in next
if len(self.__data) or self._refresh():
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\pymongo\cursor.py", line 1155, in _refresh
self.__send_message(q)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\pymongo\cursor.py", line 1044, in __send_message
response = client._run_operation(
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\pymongo\mongo_client.py", line 1424, in _run_operation
return self._retryable_read(
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\pymongo\mongo_client.py", line 1525, in _retryable_read
return func(session, server, sock_info, secondary_ok)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\pymongo\mongo_client.py", line 1420, in _cmd
return server.run_operation(
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\pymongo\server.py", line 98, in run_operation
message = operation.get_message(
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\pymongo\message.py", line 351, in get_message
request_id, msg, size, _ = _op_msg(
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\pymongo\message.py", line 743, in _op_msg
return _op_msg_uncompressed(
bson.errors.InvalidDocument: cannot encode object: <User: User object (64817a152964b416ce6c0c9c)>, of type: <class 'job_app.models.User'>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\djongo\cursor.py", line 65, in fetchmany
ret.append(self.result.next())
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\djongo\sql2mongo\query.py", line 797, in __next__
result = next(self._result_generator)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\djongo\sql2mongo\query.py", line 830, in __iter__
raise exe from e
djongo.exceptions.SQLDecodeError:
Keyword: FAILED SQL: SELECT "job_app_user"."_id", "job_app_user"."username", "job_app_user"."email", "job_app_user"."password", "job_app_user"."location", "job_app_user"."isAdmin", "job_app_user"."isAgent", "job_app_user"."skills", "job_app_user"."profile", "job_app_user"."timestamps" FROM "job_app_user" WHERE "job_app_user"."_id" = %(0)s LIMIT 21
Params: (<User: User object (64817a152964b416ce6c0c9c)>,)
Version: 1.3.6
Sub SQL: None
FAILED SQL: None
Params: None
Version: None
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\db\utils.py", line 98, in inner
return func(*args, **kwargs)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\djongo\cursor.py", line 70, in fetchmany
raise db_exe from e
djongo.database.DatabaseError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\core\handlers\exception.py", line 56, in inner
response = get_response(request)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\core\handlers\base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\views\decorators\csrf.py", line 55, in wrapped_view
return view_func(*args, **kwargs)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\views\generic\base.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\views.py", line 480, in raise_uncaught_exception
raise exc
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "C:\Users\omuya\projects\django_jobapp_api\jobapp_api\job_app\views.py", line 36, in post
if serializer.is_valid():
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\serializers.py", line 227, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\serializers.py", line 426, in run_validation
value = self.to_internal_value(data)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\serializers.py", line 483, in to_internal_value
validated_value = field.run_validation(primitive_value)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\relations.py", line 153, in run_validation
return super().run_validation(data)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\fields.py", line 547, in run_validation
value = self.to_internal_value(data)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\rest_framework\relations.py", line 264, in to_internal_value
return queryset.get(pk=data)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\db\models\query.py", line 646, in get
num = len(clone)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\db\models\query.py", line 376, in __len__
self._fetch_all()
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\db\models\query.py", line 1867, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\db\models\query.py", line 87, in __iter__
results = compiler.execute_sql(
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\db\models\sql\compiler.py", line 1431, in execute_sql
return list(result)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\db\models\sql\compiler.py", line 1931, in cursor_iter
raise dj_exc_value.with_traceback(traceback) from exc_value
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\django\db\utils.py", line 98, in inner
return func(*args, **kwargs)
File "C:\Users\omuya\projects\django_jobapp_api\jobapi\lib\site-packages\djongo\cursor.py", line 70, in fetchmany
raise db_exe from e
django.db.utils.DatabaseError
[08/Jun/2023 10:00:15] "POST /job/64817a152964b416ce6c0c9c HTTP/1.1" 500 249955
pip3 install sqlparse==0.2.4
by installing above line you can solve it
I am using djongo 1.3.3 with Django 3.1.1 and running MongoDB 4.4.0 on mac and ubuntu 20 this command worked:
python manage.py makemigrations
but when I run this command :python manage.py migrate
that show me this error:how can I fix it?