/explore
|
You are here |
www.kencochrane.com | ||
| | | | |
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" |
|
| | | | | ||
| | | | |
schinckel.net
[AI summary] The article explains how to create and use database views in PostgreSQL, including their syntax, differences between UNION and UNION ALL, and integration with Django models for read-only data access. |
|
| | | | | ||
| | | | |
endormi.io
I maintain a couple of open source projects and contribute to many projects. Here are just a few of the projects that I maintain: automation - Collection of my automated tasks written in Python. awesome-dj - List of reasons why Django is awesome for web development && Django bootstrap boilerplate. devisle/advanced-react-cli - An NPM package which aims to provide a better way to install packages for your react application through an intuitive CLI. |
|
| | | | | ||
| | | | |
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, schema_editor): # - this Statement is instantiated by the _create_index_sql() # method of django.db.backends.base.schema.BaseDatabaseSchemaEditor. # using sql_create_index template from # django.db.backends.postgresql.schema.DatabaseSchemaEditor # - the template... |
|
| | | |||