Skip to content
Advertisement

FASTAPI Delete Operation giving Internal server error

I have this code for delete operation on a Postgresql DB: The create and read operations work fine. If I pass an existing or a non-exsiting id to delete, I get a 500 Internal Server error. The row does get deleted from the table though. If I comment this line deleted_post = cursor.fetchone(), it works okay. Here is the error

Trying to add a field to Django many-to-many relation

Right now I’m working on a Django project responsible for the warehouse management system. I got products, customers, warehouse branches, product types, orders, etc… products can be [Milk 1L bottle, cheese 500g pack, ….] The problem I have been facing is that I’m trying to make a many-to-many relationship between orders and products so I can track the products sold

Length key in dictonary

How can I find out the length of the values of the key? I have code: It gives me: key : … (not length and count) And should: How should I do it? Answer There are three problems with your code: __len__ is a method, not an attribute. You get the length of an iterable using the len function: Docs

What does NameError mean in python? [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed last month. Improve this question I cannot get where my error is in my code. When I try to

Passing command to the called script [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed last month. Improve this question I

How to replace irrelevant data into mean values?

Let’s say I have 600,000 data points in column for age. In the data there are values 0 and -1, which is not relevant for age. How can I change both 0 and -1 values in my data to the column mean value using python? The code so far: Answer You can find the mean separatly and then use the

can’t put variables inside sqlite3 query in flask

Like documentation says, and I tried: it didn’t work, and I tried: also didn’t work. How can I pass variables inside my request? Answer The insertion looks correct. However, until you perform a commit, any DML operation (like an insert) would only be visible from the session that performed it, and will implicitly be rolled back when the connection is

Trying to type ‘→’ with keyboard module

I am making a program that writes a program in TI-Basic. In TI-Basic, to set a variable, the syntax is value → varname. The TI-Connect software doesn’t like it when I copy-paste, so I’m using the keyboard module to simulate keypresses. I can’t manually type the program as it is about 850 lines long. When I try to run the

Advertisement