Specifically, I used pandasql to query a pandas dataframe like this:
dataset = "SELECT assetName, universe,volume,returnsClosePrevRaw1 AS Close FROM market ORDER BY assetName DESC LIMIT 5"
print(ps.sqldf(dataset, locals()))
The class of "dataset" is str.
I will like to save "dataset" as a csv file to pandas dataframe
Here is a print screen: