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 "ArrayF
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 k
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 O
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
> colu
> 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 expressi
>
> 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 a
+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 wid