Re: Generated Field

2023-01-01 Thread Jeremy Nauta
I have implemented a first draft for this feature! Feedback and ideas are greatly appreciated. https://github.com/django/django/pull/16417 https://code.djangoproject.com/ticket/34238 On Saturday, December 24, 2022 at 8:56:38 p.m. UTC-7 schinckel wrote: > I believe there are a bunch of

Re: Generated Field

2022-12-24 Thread 'schinckel' via Django developers (Contributions to Django itself)
I believe there are a bunch of similarities between the requirements of generated fields and my project django-shared-property: https://django-shared-property.readthedocs.io/en/latest/ On Sunday, December 25, 2022 at 10:23:10 AM UTC+10:30 jeremy...@gmail.com wrote: > I'd love to help

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 an

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)
> > What about we make the expected signature `GeneratedField(expression, > base_field=None)` where a missing `base_field` defaults to > `expression.output_field`? That would allow the exact expected SQL to be > generated with `GeneratedField('title', base_field=SearchVectorField())` if > there's

Re: Generated Field

2022-04-13 Thread charettes
> Is it necessary to take a base field? Can we not determine the output field type for some kinds of expression? e.g. F("some_integer_field") + 1 can be assumed to have output field type IntegerField. It should be possible by simply accessing the `output_field` property of the provided

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