Re: Extending JSONField serialization

2016-06-22 Thread Marcin Nowak
> > > > It's not resolved - the ticket is open, and Accepted. > > Thanks. I've seen comment with status set to closed and I didn't notice the current. My fault. Marcin -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django

Re: Extending JSONField serialization

2016-06-22 Thread Daniele Procida
On Wed, Jun 22, 2016, Marcin Nowak wrote: >On Tuesday, January 5, 2016 at 5:29:14 PM UTC+1, Tim Graham wrote: >> >> This came up in a ticket a couple days ago: >> https://code.djangoproject.com/ticket/25995 >May I ask why this ticket was resolved just by adding some

Re: Extending JSONField serialization

2016-06-22 Thread Marcin Nowak
On Tuesday, January 5, 2016 at 5:29:14 PM UTC+1, Tim Graham wrote: > > This came up in a ticket a couple days ago: > https://code.djangoproject.com/ticket/25995 > >> >> May I ask why this ticket was resolved just by adding some information to the documentation? I do not understand why some

[Off topic] Re: Extending JSONField serialization

2016-01-06 Thread Shai Berger
Pet peeve: Please ignore if you don't care about database technologies. On Wednesday 06 January 2016 17:12:34 Dwight Gunning wrote: > design models that are a hybrid of our traditional, schema-oriented > approach, but also include a JSON Field and offer the benefits of the more > recent

Re: Extending JSONField serialization

2016-01-06 Thread Raphaël Barrois
On Wed, 6 Jan 2016 10:27:01 -0500 Michael Manfre wrote: > On Wed, Jan 6, 2016 at 9:58 AM, Tom Christie wrote: > > > Customizing the encoder (or even using DjangoJSONEncoder by default) isn't > > so bad. > > > > I'm less convinced about the usefulness

Re: Extending JSONField serialization

2016-01-06 Thread Dwight Gunning
Aymeric, thanks for clarifying. I take your point for joins although I'm a bit surprised you don't feel JSONFields are appropriate for filtering. I haven't tried yet but I am interested in the ability to efficiently index into the JSONField (thanks to use of Postgres' jsonb fields). That is, to

Re: Extending JSONField serialization

2016-01-06 Thread Michael Manfre
On Wed, Jan 6, 2016 at 9:58 AM, Tom Christie wrote: > Customizing the encoder (or even using DjangoJSONEncoder by default) isn't > so bad. > > I'm less convinced about the usefulness of customizing the decoder - once > you've encoded the data into JSON any additional type

Re: Extending JSONField serialization

2016-01-06 Thread Tom Christie
Customizing the encoder (or even using DjangoJSONEncoder by default) isn't so bad. I'm less convinced about the usefulness of customizing the decoder - once you've encoded the data into JSON any additional type information is lost, so casting back to python primitives is always going to need

Re: Extending JSONField serialization

2016-01-06 Thread Aymeric Augustin
Hello Dwight, I was trying to express the fact that JSONField is appropriate for storing data that won’t be used for joining other tables, filtering, aggregating, etc. but rather just for reading. “Not mission-critical” was a simplification. That said, data that meets the criteria above tends

Re: Extending JSONField serialization

2016-01-06 Thread Dwight Gunning
It's interesting that you say JSON Fields shouldn't be used for mission critical data. Is that widely recognised? I feel like there are genuine uses cases for using JSON Fields to store mission critical data. For instance, a Javascript single-page-app style client with a set of user

Re: Extending JSONField serialization

2016-01-05 Thread Michael Manfre
It should be configurable and I like the kwargs idea. I've also had to monkey patch JSONField in this way for datetimes. Regards, Michael Manfre On Tue, Jan 5, 2016 at 12:48 PM, Aymeric Augustin < aymeric.augus...@polytechnique.org> wrote: > > On 5 janv. 2016, at 18:37, Tom Christie

Re: Extending JSONField serialization

2016-01-05 Thread Aymeric Augustin
> On 5 janv. 2016, at 18:37, Tom Christie wrote: > >> Should JSONField accept additional kwargs to customize the encoder and the >> decoder? > > Quick take here: > > That sounds like a bit too much "cleverness" to me. The most obvious issue > it'd cause is putting

Extending JSONField serialization

2016-01-05 Thread Tom Christie
> Should JSONField accept additional kwargs to customize the encoder and the > decoder? Quick take here: That sounds like a bit too much "cleverness" to me. The most obvious issue it'd cause is putting values of one type into the field, but getting objects of a different type back. (eg

Re: Extending JSONField serialization

2016-01-05 Thread Tim Graham
This came up in a ticket a couple days ago: https://code.djangoproject.com/ticket/25995 On Tuesday, January 5, 2016 at 11:18:01 AM UTC-5, Aymeric Augustin wrote: > > Hello, > > I’m using the JSONField provided by django.contrib.postgres for logging > arbitrary data to PostgreSQL. > > For this

Extending JSONField serialization

2016-01-05 Thread Aymeric Augustin
Hello, I’m using the JSONField provided by django.contrib.postgres for logging arbitrary data to PostgreSQL. For this use case, I’d like my data to be JSON serialized with as little fuss as possible. Unfortunately lots of things (dates, datetimes, decimals, etc.) aren’t natively