Opened 3 years ago
Last modified 3 years ago
#33424 closed Bug
Jsonfield data being returned as str — at Version 1
Reported by: | nitishxp | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.2 |
Severity: | Normal | Keywords: | Database, Django Cursor |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Hi,
I encountered a bug in raw postgresql query
from django.db.models import JSONField from django.db import connection class Job(models.Model): job_dict = JsonField() def view(request): with connection.cursor() as cursor: cursor.execute("select job_dict from app.job", ()) column_names = [desc[0] for desc in cursor.description] results = [dict(zip(column_names, row)) for row in cursor.fetchall()]
The given result will have the job_dict column as string instead of dictionary
Change History (2)
by , 3 years ago
Attachment: | Django.png added |
---|
comment:1 by , 3 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.