Skip to main content

All Questions

Tagged with
1 vote
0 answers
52 views

Optimizing Django ORM for Hybrid Queries (PostgreSQL + Vector Similarity Search)

I'm implementing a RAG (Retrieval-Augmented Generation) system that requires combining traditional Django ORM filtering with vector similarity searches. The specific workflow needs to: First filter ...
MD Abdur Rahim's user avatar
0 votes
0 answers
33 views

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in Django connection with PostgreSQL in Docker

I am trying to connect my Django application to PostgreSQL running in a Docker container, but when I execute python manage.py runserver or python manage.py makemigrations, I get the following error: ...
Gustavo Luis Serpa's user avatar
-4 votes
1 answer
70 views

How to properly connect PostgreSQL with Django? [duplicate]

I'm working on a Django project and using PostgreSQL as my database. I updated my settings.py as follows: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', '...
M Haseeb Ali's user avatar
0 votes
1 answer
60 views

Can I create foreign key with specific value match from parent table

Suppose Parent table is CREATE TABLE departments ( department_id SERIAL PRIMARY KEY, department_name VARCHAR(100) NOT NULL, department_type VARCHAR(100) NOT NULL ); Suppose ...
user3036282's user avatar
2 votes
1 answer
53 views

Django models migration gets generated after managed set to False [duplicate]

In my django project, I have 2 databases, and I'm trying to achieve a cross database foreign key relationship. the models Form, FormSubmission, CmsEvent are in a postgres database and the models ...
Abhishek AN's user avatar
0 votes
0 answers
49 views

How does one correctly define an index for efficiently querying the reverse relation for ForeignKey fields? (when starting from parent.related_set)

FINAL EDIT: Okay, I've been asked to refine my question to as someting more specific/concrete. So here is the question: Given the following model definitions: class ParentModel(models.Model): # ...
Eric's user avatar
  • 48
1 vote
0 answers
65 views

Why does duplicating a Django filter condition change PostgreSQL’s query plan estimates?

I'm working on a Django project with PostgreSQL and have implemented a custom filter to select "active" records. The filter is defined as follows: def get_custom_filter(qs): return qs....
Tsygankov Alexander's user avatar
0 votes
1 answer
48 views

Error when applying migrations 'no password supplied', but I can connect to the database from the interpreter

I decided to revive my pet project that I wrote 2 years ago.First I had to update some dependencies that couldn't be installed. The django version remained the same. But migrations are not performed ...
Владимир Рост's user avatar
0 votes
2 answers
53 views

column "now" does not exist postgres django

I have a django app that store a date column in a model/table in postgres first_subscribed = models.DateField(auto_now=True), and it works fine. But if I enable a trigger to copy data from the table/...
Israel Rodriguez's user avatar
2 votes
2 answers
115 views

Database Connections Spiking on Heroku Dyno Startup with django-db-geventpool – MAX_CONNS Not Enforced

I'm using Django, Gunicorn with Gevent, and django-db-geventpool on Heroku (Performance L dynos, WEB_CONCURRENCY=17). My database connections spike significantly on dyno startup, exceeding the ...
Johnny Metz's user avatar
  • 5,647
0 votes
3 answers
88 views

How to find server_version in psycopg3?

I have this test in Django [1] which is using psycopg2: from django.db import connection def test_postgresql_version(self): postgresql_version = connection.cursor().connection.server_version ...
Uri's user avatar
  • 3,321
0 votes
1 answer
55 views

How to migrate Django from local sqlite3 to postgresql Docker container?

I'm trying to learn Django with some demo projects and want to migrate from sqlite3 to a local postgresql container for dev work. When I try to run uv run python manage.py migrate, I get the following ...
Jason Jarosz's user avatar
0 votes
2 answers
46 views

How to handle authentication and AUTH_USER_MODEL in Django multi-tenant with separate schemas in PostgreSQL?

I’m developing a multi-tenant SaaS application using Django, where each tenant has its own separate database with its own schema and relationships. However, I'm struggling with how to properly manage ...
Br0k3nS0u1's user avatar
0 votes
2 answers
135 views

Ordering data after distinct

I distinct data by sku_id queryset = self.filter_queryset(queryset.order_by('sku_id','id').distinct('sku_id')) However this result is not sorted by id, then I try to queryset = self....
whitebear's user avatar
  • 12.5k
2 votes
3 answers
73 views

Conditional aggregate and distinct

Using StringAgg with the distinct=True argument works under normal circumstances, e.g.: entities = entities.annotate(roles=StringAgg( "credits__role__name", delimiter=", ", ...
bur's user avatar
  • 817

15 30 50 per page
1
2 3 4 5
538