I'm trying to retrieve a newly added data from Oracle DB using Python. I added the data using a web form and it has more field than what I've in the query below. Let say order date, ship date, etc.

I got this far with it, but not sure if the beginning itself is correct and I'm stuck here. Not sure how to check the returned data is what I'm actually looking for. How do i do that?

db = DBConnection.connect_to_intraday_db()
cursor = db.cursor()
query1 = cursor.execute("Select * from PORTFOLIO_ORDER where SYMBOL = 'TOP' and ORDER_QUANTITY = 200 and AVERAGE_PRICE = 56.99")
query1 = cursor.fetchone()
print query1

Devu

有帮助吗?

解决方案

cx_Oracle cursor return tuples. So if you want to compare in python, you have to do it in python for example:

 if  query1[0] == myFirstColumnValue:
     # Good tuple

and so on

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top