Sorry if this is a novice error but I had some problems with SELECT. I executed a query for retrieving all the stocks, which were purchased by a user, in a database called portfolio. 'Usernamer' is a global variable with the value of the current users username. The command is as follows:

stocks = db.execute("SELECT stock FROM portfolio WHERE username = :username", username = usernamer)

What will the data type that the command returns be? Will it be a list of the stocks?

Thanks for looking into this matter!

1 Answer 1


It will return a list of dicts. Each dict item contains a key:value pair, where the key should be the same as the keys in your portfolio table (ex. symbol, stockname, price) and the value being values for the keys for each stock (ex. NFLX, Netflix Inc., 150).

If you have further questions on the return types for different SQL commands, you can try the Hints section of pset7.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .