Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2024-07-22 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:  Anže
 Type:   |  Pečar
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_better_patch:  0 => 1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070190db9b059e-0b6a68c4-b7ab-41ca-8f33-85f0c222e061-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2024-06-09 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:  Anže
 Type:   |  Pečar
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Jacob Walls):

 * has_patch:  0 => 1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ffd2de3cf-01640fca-4dd1-4029-b27e-d22bbeaf5012-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2024-06-08 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:  Anže
 Type:   |  Pečar
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Paolo Melchiorre):

 The PR looks better now. Thanks for update it.
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ff869e638-cc34b53e-7104-495e-970b-b37ef834407c-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2024-06-08 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:  Anže
 Type:   |  Pečar
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Anže Pečar):

 I have added the version check to my PR, thank you Paolo, for the quick PR
 review!
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ff82b5052-d341a5a3-8631-4c90-9bfd-7faadf34ca0b-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2024-06-08 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:  Anže
 Type:   |  Pečar
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Paolo Melchiorre):

 As we discussed during the DjangoCon Europe 2024 sprints, we can't be sure
 of the SQLite version in some cases, so a version check can be useful.
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ff82285a7-5627e432-460e-49bb-857a-f5e76f8369c1-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2024-06-08 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:  Anže
 Type:   |  Pečar
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Anže Pečar):

 * owner:  (none) => Anže Pečar
 * status:  new => assigned

Comment:

 I have found this ticket during DjangoCon Europe sprints and opened a PR
 for it: https://github.com/django/django/pull/18241
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ff7a3ed31-d5eb5cfb-4ac3-4365-94df-2d3e188f760f-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2024-03-11 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:  (none)
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Claude Paroz):

 * owner:  rajdesai24 => (none)
 * status:  assigned => new

Comment:

 13 months after an assignee last commented, I guess we can assume it is
 open to anyone willing to work on it.
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e2f6012d0-6c0ee6b9-eb00-4b18-ad89-cb96ed72ac1c-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2024-03-11 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:
 Type:   |  rajdesai24
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by bcail):

 @rajdesai24, are you planning to open a PR for this?
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e2e2d0064-0d60d35d-7ec2-45c4-9b85-f0e959455823-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2023-09-22 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:
 Type:   |  rajdesai24
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Paolo Melchiorre):

 * cc: Paolo Melchiorre (added)


Comment:

 This change would be an improvement. +1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018abd0d1cc1-c7290007-0269-48f8-a9ac-41f6f7584b7f-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2023-02-19 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:
 Type:   |  rajdesai24
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by rajdesai24):

 * cc: rajdesai24 (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018669f845c6-a95161af-2bd9-4b97-8a3d-bac4341e33b6-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2023-02-10 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:
 Type:   |  rajdesai24
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by rajdesai24):

 I am quite new to this topic but based on what I can understand how about
 we put a simple version check and return the value accordingly
 something like the following which checks the version and returns the
 value accordingly.
 {{{
 if connection.sqlite_version >= '3.38':
 return (
 "(CASE WHEN JSON_TYPE(%s, %%s) IN (%s) "
 "THEN JSON_TYPE(%s, %%s) ELSE (%s ->> %%s) END)"
 ) % (lhs, datatype_values, lhs, lhs), (tuple(params) +
 (json_path,)) * 3

 else:
 return (
 "(CASE WHEN JSON_TYPE(%s, %%s) IN (%s) "
 "THEN JSON_TYPE(%s, %%s) ELSE JSON_EXTRACT(%s, %%s) END)"
 ) % (lhs, datatype_values, lhs, lhs), (tuple(params) +
 (json_path,)) * 3


 }}}
 This might make it redundant but please let me know of any suggestions.
 Till then I will dive deeper

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701863d083ebe-9452f15f-9e82-48ff-bc55-3c4d4da5f5a0-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2023-01-28 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:
 Type:   |  rajdesai24
  Cleanup/optimization   |   Status:  assigned
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by rajdesai24):

 * owner:  nobody => rajdesai24
 * status:  new => assigned


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070185f986f9fe-51eb97c9-4688-46c4-a6ac-1cff9b03c2f3-00%40eu-central-1.amazonses.com.


Re: [Django] #33548: Use -> operator to implement KeyTransform on SQLite 3.38+

2022-10-14 Thread Django
#33548: Use -> operator to implement KeyTransform on SQLite 3.38+
-+-
 Reporter:  Sage Abdullah|Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |
Component:  Database layer   |  Version:  dev
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  sqlite jsonfield | Triage Stage:  Accepted
  keytransform   |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by bcail):

 * cc: bcail (added)


Comment:

 For what it's worth, the SQLite tests pass on SQLite 3.39.4 if you replace
 JSON_EXTRACT with ->>, like this:
 {{{
 diff --git a/django/db/models/fields/json.py
 b/django/db/models/fields/json.py
 index 7296fe42bc..accc6ae61a 100644
 --- a/django/db/models/fields/json.py
 +++ b/django/db/models/fields/json.py
 @@ -361,7 +361,7 @@ class KeyTransform(Transform):
  )
  return (
  "(CASE WHEN JSON_TYPE(%s, %%s) IN (%s) "
 -"THEN JSON_TYPE(%s, %%s) ELSE JSON_EXTRACT(%s, %%s) END)"
 +"THEN JSON_TYPE(%s, %%s) ELSE (%s ->> %%s) END)"
  ) % (lhs, datatype_values, lhs, lhs), (tuple(params) +
 (json_path,)) * 3

 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183d730b9b2-4fa35999-dedc-4c98-bdf4-60f688453251-00%40eu-central-1.amazonses.com.