Creating dataframes from a list of queries with a defined list of names

I am trying to run a query which changes the name of different dataframes pulled from an SQL database. I have developed a simple definition to run the query given the name of the SQL file. the for loop is running properly but it will rewrite Query to the last observed dataframe from the report function.

def report(query_name):

   df = []

   filename = query_name +'.sql'

   # read the sql file 
   with open(filename, 'r') as query:

       connection = sql_server_connection(server = "server", database = "database")
       with connection:
            df = pd.read_sql_query(, connection)
   return df

queries = ['name1','name2','name3']

for query in queries:
    query = report(query)

What I wish to see from this is

name1 = data from report(name1)

name2 = data from report(name2)

name3 = data from report(name3)

Any assistance would be greatly appreciated.


Try this

queries = ['name1','name2','name3']
querie_data = {}

for query in queries:
    querie_data[query] = report(query)

To access the data