Django & postgress sometime result into empty resultset

I have a table name finance_details.

Table Structure:

     "id" int4 NOT NULL DEFAULT nextval('finance_ior_details_id_seq'::regclass),
    "ramco_invoice_id" varchar(255) NOT NULL,
    "ramco_job_id" varchar(255) NOT NULL,
    "amount" float8 NOT NULL,
    "invoice_id_id" int4 NOT NULL,
    "client_id_id" int4 NOT NULL,
    "created_at" timestamptz NOT NULL,
    "created_by_id" int4 NOT NULL,
    "product" varchar(255) NOT NULL,
    "seller_id_id" int4 NOT NULL,
    "modified_at" timestamptz,
    "is_paid" bool,
    CONSTRAINT "app_payment_gateway__created_by_id_bdd12b5e_fk_res_user_" FOREIGN KEY ("created_by_id") REFERENCES "public"."res_user"("id"),
    CONSTRAINT "finance_ior_details_client_id_id_e4f61090_fk_client_client_id" FOREIGN KEY ("client_id_id") REFERENCES "public"."client_client"("id"),
    CONSTRAINT "finance_ior_details_invoice_id_id_a3d128b5_fk_seller_invoice_id" FOREIGN KEY ("invoice_id_id") REFERENCES "public"."seller_invoice"("id"),
    CONSTRAINT "finance_ior_details_seller_id_id_74c41a5c_fk_seller_id" FOREIGN KEY ("seller_id_id") REFERENCES "public"."seller"("id"),
    PRIMARY KEY ("id")

When I query using invoice_id_id = value and is_paid = False. Data exist in table but resultset is empty.

Below code

invoice_details = SellerInvoice.objects.get(id=sample_string)

finance_details = FinanceIORDetails.objects.filter(invoice_id=sample_string, is_paid=False).first()

if not finance_details:
   raise Exception("detail not found")

Can anyone pls help as this is happening on production.

Data exists in table but resultset is empty.

Back to Top