Questions tagged [django]

49 questions
6
votes
2 answers

Django postgres multiple schema

I'm trying to develop a django interface for an existing postgresql db, the db makes use of various schemas, looking at the literature the following example should work, but it only returns the schema defined in the default database when I run…
Spatial Digger
  • 207
  • 1
  • 4
  • 8
4
votes
0 answers

Database Design for tracking user flow

I want to design a user tracking system between different tables/models. I want to track the user's progress. There is a Module table which is related to sections and sections are related to sub-sections. Each sub-section can relate to different…
3
votes
1 answer

Modelling a database for a travelling business that involves Vehicules, Routes, Subroutes and Prices

I am working on travelling app, where users can book online vehicles to travel. On the customer side I would like this flow: Users have to select a from location and a to location Enter how many seats they require Select a travel date Search for…
Aamu
  • 131
  • 2
3
votes
2 answers

Getting Postgres CREATE TABLE statements

I created some tables (9, to be exact) with a Django (1.9.6) migration and now I'm trying to get simple CREATE TABLE statements for them. I tried this answer, but using pg_dump in this way gives me over 800 lines of output for the 9 tables. For…
wogsland
  • 416
  • 2
  • 7
  • 16
3
votes
1 answer

Database in postgresql with missing rows, how to fill the missing rows with a backup copy?

I have a big problem and I'm not that good with postgresql since I use Django to make queries and I only have the basics of sql for querys. My problem is that there was a problem where a super user deleted a field that was related with my table…
Lord Maxus
  • 33
  • 1
  • 5
2
votes
1 answer

Sensible max_length for Postgres db charfields

I am using Django with a Postgres backend. In the Django models, I have to set the max_length attribute on the Charfields, then the Django ORM deals with the database in the backend. In a lot of cases, those are rather small fields (e.g. say names,…
2
votes
1 answer

Duplicate key errors in Postgres queue-like table when rows should be locked by SELECT FOR UPDATE SKIP LOCKED

I have a table called queue with items that need to be processed: CREATE TABLE public.queue ( id serial NOT NULL CONSTRAINT queue_pkey PRIMARY KEY ); Another table process represents processed items from the queue (e.g. a…
illagrenan
  • 123
  • 5
2
votes
2 answers

Designing a multi-tenant database for a scenario with multiple user types

I'm developing a SaaS application for recruiting which has multiple user types such as Client, Recruiter, Panellist and Owner etc. There is also a chance that the user types may increase. The Owner has an Organization and this is what will be my…
2
votes
1 answer

UUID as primary key and download ID

I'm designing a Django Rest Framework API with PostgreSQL. In the database I'll be recording information about documents which can be requested for download. I want the request to include a unique id, so the server knows which document to retrieve.…
TwanK
  • 21
  • 1
2
votes
1 answer

Field/datatype for searchable address components?

I'm using Django with Postgres, and I'm looking for a field/datatype to store address components that come from Google Places API in this format: "address_components": [ {"long_name": "27", "short_name": "27", "types": ["street_number"]}, …
davidtgq
  • 759
  • 1
  • 8
  • 23
2
votes
1 answer

Postgresql tables seem duplicated (with suffixes such us pkey, hashes, etc)

due to some problems I came to check the state of my current database in production and I found that some tables are "duplicated". By duplicated I mean that there appear to be some clones of the actual table, with the same name and a suffix. An…
vabada
  • 123
  • 5
1
vote
0 answers

Railway - problems with connecting to postgres in production

Django worked perfectly locally, but had errors in production (I was using the same postgres DB and configuration). Django server, hosted on Railway gave me this: Newtorking tab in Postgres settings on Railway: Postgres logs locally: Settings:…
Mikheil
  • 11
  • 1
1
vote
0 answers

Migrating PostgreSQL (Django REST Framework) to slightly different PostgreSQL (FastAPI). Best way to do it?

I need to migrate data from a relatively small PostgreSQL database (let's call it DB 1) of a Django REST Framework project to another PostgreSQL database of my FastAPI project (DB 2). Say 500,000 rows. The tables are slightly different. DB 1 uses…
PythonForEver
  • 133
  • 1
  • 6
1
vote
0 answers

Storing user defined forms and their data

I'm writing an application that would have a feature similar to Google Forms. In this feature, some end users of the system will have the ability to design custom forms. Those forms will subsequently be filled by other users. So there are two…
hashemi
  • 111
  • 2
1
vote
2 answers

Why is ASC 100x faster than DESC and what can I do about it?

I'm on the cusp of understanding this, but I don't understand the fix that I need. The following query takes about minute, give or take, to return 20 records: explain (analyze, buffers) select "search_docket"."id" FROM "search_docket" WHERE…
1
2 3 4