My SQL table 'portfolio' has three fields: id, stock, shares. I use the below code to retrieve stock and shares for a particular user. In my test case, user has three different stocks(TEXT), with corresponding shares(INTEGER). When I print out holdings I get:
holdings = [{'shares': 'ab'}, {'shares': 'ba'}, {'shares': 'nvda'}]
Why is the shares key paired with the stock value? What happens to the stock key and the shares values?
# query portfolio for stock holdings
holdings = db.execute("SELECT stock shares FROM portfolio WHERE id = :id", id=session['user_id'])