You are here |
schinckel.net | ||
| | | |
jinyuz.dev
|
|
| | | | Often, I forget how to display the raw SQL of a queryset in Django. This is a quick and easy example of how to do it from django.contrib.auth.models import User qs = User.objects.all() print(qs.query) SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" | |
| | | |
vxlabs.com
|
|
| | | | In order to add a GiST index on a Postgres database that could be used to accelerate trigram matches using the pg_trgm module and the special gist_trgm_ops operator, I had to code up a special Django Index Django will hopefully soon support custom index operators, but if you need the functionality right now, this example will do the trick. The special GiST index class looks like this: from django.contrib.postgres.indexes import GistIndex class GistIndexTrgrmOps(GistIndex): def create_sql(self, model, sch... | |
| | | |
www.kencochrane.com
|
|
| | | | ||
| | | |
www.mattlayman.com
|
|
| | On this episode, we will explore more about models and how to interact with data in your database. |