I'm working on a python assignment and I am facing an issue. My question is the following:
"Write a query to select all rows from the sales
table. Merge with the table returns by INNER JOIN
on the Order ID
. Put the result in a variable QUERY
."
So I wrote this code:
sales_row = pd.read_sql("SELECT * FROM sales", mydb)
QUERY = pd.merge(sales_row, returns, on = "Order ID", how = "inner")
It works, but then I'm asked to perform a query on the database so I wrote the following:
pd.read_sql_query(QUERY, mydb)
And I get the following error:
ObjectNotExecutableError: Not an executable object
What can I do to fix this issue?