Answer the question
In order to leave comments, you need to log in
Why SQL query returns None?
The essence of this is the request:
SELECT prod_type_id FROM "PROD_TYPE" WHERE prod_type_id=2
currDst.execute(("""SELECT prod_type_id FROM "PROD_TYPE" WHERE prod_type_id=%s""") %prod_type_id)
pt = currDst.fetchone()
print "pt: ", pt # упорно возвращает pt: None хотя заспрос содержит данные
Answer the question
In order to leave comments, you need to log in
Are you sure prod_type_id contains 2?
Well, and a mandatory recommendation that you do not need to collect SQL queries from strings, but you need to bind parameters.
Also, it looks like you are trying to mimic a JOIN in python code.
Try this when you raise the connection to the database:connDst.autocommit(True)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question