I'm working on a put
request for a proof-of-concept at work. This project is my first time working with SQL since I got frustrated with it 10 years ago, so bear with me.
I want to update the POTS lines information for a particular store, so I'm having a request sent with data I'll parse and send an UPDATE
query. I'm finding success when doing 1 individual entry at a time, but when adding multiple variables it gives me an error stating no column found by name: <name>
where <name>
is equal to the value I sent in the very next entry.
So take this statement:
cur.execute('UPDATE Pots SET Pots_ForwardOnFail={1}, Pots_FirePrimary={2}, Pots_FireSecondary={3}, Pots_BurglarPrimary={4}, Pots_DNR={5}, Pots_Passenger={6}, Pots_Freight={7} WHERE StoreNumber={0};'.format(args["Store"], args["HuntLine"], args["FirePrimary"], args["FireSecondary"], args["Burglar"], args["DNR"], args["PassengerElevator"], args["FreightElevator"]))
This sample post:
curl --request POST \
--url http://127.0.0.1:9099/pots/42 \
--form Store=42 \
--form HuntLine=OnTheHunt \
--form FirePrimary=FireHot \
--form FireSecondary=FireNotSoHot \
--form Burglar=Hamburglar \
--form DNR=DNWut \
--form PassengerElevator=GoingUp \
--form FreightElevator=GoingDown
This would update the database column Pots_ForwardOnFail
for store 42
with the value OnTheHunt
, however I would be prompted with an error:
sqlite3.OperationalError: no such column: OnTheHunt
I've tried methods to no avail, and this just tells me that my syntax for handling multiple variables is not correct when working with UPDATE
.