I am writing to ask for your help. I am trying to generate a SQL query from a variable, this variable is associated with the table name. The objective of this is that I can choose from a GUI the table I want to access to be able to display the data through the Treeview Widget. I have not managed to generate the SQL statement that allows me to do this.
def run_query(self,query,parameters=()):
with sqlite.connect(self.db_name) as conn:
self.cursor=conn.cursor()
self.result=self.cursor.execute(query,parameters)
conn.commit()
return self.result
def view(self,value):#Pasar el parámetro Value desde el SCRIPT PPAL.
query='SELECT * FROM 'value';'
parameters=value
self.run_query(query)
self.cursor.description()
The variable "value" is comes from another routine associated with the GUI of the application, the idea of this routine is to be able to read the information from the headers of the columns of the selected table through the variable value.