--
Ticket URL: <https://code.djangoproject.com/ticket/30369>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* version: 2.2 => master
Comment:
I don't think that we will support `CREATE TABLE AS SELECT`. In your use
case I would create `MATERIALIZED VIEW` (or `VIEW`) in a migrations with
raw SQL. Such views can be introspected automatically (see
[https://docs.djangoproject.com/en/2.2/ref/django-admin/#database-
specific-notes inspectdb]) and used via Django ORM (see
[https://docs.djangoproject.com/en/2.2/ref/models/options/#django.db.models.Options.managed
managed option]).
--
Ticket URL: <https://code.djangoproject.com/ticket/30369#comment:1>
Comment (by Markus Elfring):
Replying to [comment:1 felixxm]:
* Does the functionality “materialized view” provide run time
characteristics which are similar to the CTAS command?
* Does it belong to the SQL standard?
* The support for it varied between databases over time. How will the
software evolve further in this area?
--
Ticket URL: <https://code.djangoproject.com/ticket/30369#comment:2>
* status: new => closed
* resolution: => wontfix
Comment:
> * Does the functionality “materialized view” provide run time
characteristics which are similar to the CTAS command?
Yes it is quite similar, db will recognize column types.
> * Does it belong to the SQL standard?
I'm not sure, but I don't think so.
> * The support for it varied between databases over time.
Materialized views are supported on PostgreSQL and Oracle.
> * How will the software evolve further in this area?
Do you mean by databases? I don't know answer for such existential
question :)
Please use one of
[https://code.djangoproject.com/wiki/TicketClosingReasons/UseSupportChannels
support channels] if you have other support questions related with Django.
If you have questions about databases you should probably ask somewhere
else e.g. on StackOverflow.
--
Ticket URL: <https://code.djangoproject.com/ticket/30369#comment:3>
* status: closed => new
* resolution: wontfix =>
Comment:
Replying to [comment:3 felixxm]:
> I'm not sure, but I don't think so.
I would find the support for the SQL standard statement “CREATE TABLE AS
SELECT” (CTAS) nicer (while working with materialized views can be
similarly useful).
--
Ticket URL: <https://code.djangoproject.com/ticket/30369#comment:4>
* status: new => closed
* resolution: => wontfix
Comment:
Please start a new thread on
[https://groups.google.com/forum/?utm_source=digest&utm_medium=email#!forum
/django-developers `django-developers`] if you really think that support
for `CREATE TABLE AS SELECT` should be added to the Django ORM. IMO use
case is really narrow because even if you will create such table in ORM it
will be tricky to make it accessible via ORM.
We can reopen this ticket if we reach consensus on `django-developers`.
--
Ticket URL: <https://code.djangoproject.com/ticket/30369#comment:5>