Re: Generated Field

2023-01-01 Thread Jeremy Nauta
this if we can find a rough syntax! I've made >> a proof of concept in Postgres, and there are two outstanding limitations >> to address: >> >> - The generated field value is not set until the model is reloaded from >> the database >> - The `GENERATED ALWAYS` ex

Re: Generated Field

2022-12-24 Thread 'schinckel' via Django developers (Contributions to Django itself)
elp implement this if we can find a rough syntax! I've made a > proof of concept in Postgres, and there are two outstanding limitations to > address: > > - The generated field value is not set until the model is reloaded from > the database > - The `GENERATED ALWAYS` expression

Re: Generated Field

2022-12-24 Thread Jeremy Nauta
I'd love to help implement this if we can find a rough syntax! I've made a proof of concept in Postgres, and there are two outstanding limitations to address: - The generated field value is not set until the model is reloaded from the database - The `GENERATED ALWAYS` expression requires

Re: Generated Field

2022-04-13 Thread Dan Davis
+1 On Wed, Apr 13, 2022 at 7:01 AM 'Adam Johnson' via Django developers (Contributions to Django itself) wrote: > I'd be interested in seeing this. Generated columns are a useful SQL > feature that are missing from Django. > > Nice initial research on backend coverage - it looks like they're

Re: Generated Field

2022-04-13 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
the reported case the user would have to do > `GeneratedField(SearchVector('title'))` which would actually result in > `tsvector GENERATED ALWAYS AS *to_tsvector*(title)` STORED which is not > exactly the same. It's not an issue here but I wouldn't be surprised that > not being able

Re: Generated Field

2022-04-13 Thread charettes
dn't be surprised that not being able to configured a generated field to generate a particular SQL output might be problematic in some cases. What about we make the expected signature `GeneratedField(expression, base_field=None)` where a missing `base_field` defaults to `expression.output_f

Re: Generated Field

2022-04-13 Thread Kye Russell
I’d love to see this! Kye On 13 Apr 2022, 7:05 PM +0800, Mariusz Felisiak , wrote: > Related tickets: > > - https://code.djangoproject.com/ticket/31300: Add function-based virtual > fields on PostgreSQL and Oracle. > - https://code.djangoproject.com/ticket/31565: Support GENERATED ALWAYS >

Re: Generated Field

2022-04-13 Thread Mariusz Felisiak
Related tickets: - https://code.djangoproject.com/ticket/31300: Add function-based virtual fields on PostgreSQL and Oracle. - https://code.djangoproject.com/ticket/31565: Support GENERATED ALWAYS columns for MySQL and PostgreSQ Related DEP: - https://github.com/django/deps/pull/39 - Refactor

Re: Generated Field

2022-04-13 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
I'd be interested in seeing this. Generated columns are a useful SQL feature that are missing from Django. Nice initial research on backend coverage - it looks like they're widely supported. Some ideas... Is it necessary to take a base field? Can we not determine the output field type for some

Generated Field

2022-04-13 Thread Paolo Melchiorre
Hi all, I am at PyCon DE 2022 in Berlin with Markus and I shared with him this idea that I have been thinking about for a few months, given his interest I also share it with you. I figured we could add in Django a "GeneratedField" which accepts a "base_field" attribute in a similar way to