-
Is it possible to use the query from a existing queryset instead of hardcoding a sql query on class attribute. example: class MetadataRelationView(pg.MaterializedView):
title = models.CharField(max_length=4096)
abstract = models.CharField(max_length=4096)
keywords = models.CharField(max_length=4096)
search = models.TextField(max_length=20)
sql = MetadataRelation.objects.for_search().query
class Meta:
managed = False
db_table = 'registry_metadata_relation_view' But this causes in AppRegistryNotReady cause the |
Beta Was this translation helpful? Give feedback.
Answered by
jokiefer
Nov 24, 2023
Replies: 1 comment 4 replies
-
Hm interesting! Replicating a similar setup I got a different error (
Maybe it depends on order? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Finally i made it!
Django does not interpolate the parameters from the query. See hint from stackoverflow for description.
So the key was to trigger the execution of the query to get the correct evaluated sql statement from it. See django docs for more details.
My solution is the following: