I'm developing a simple application where you'll need to create a PostgreSQL view via Python function. So far it seems like a simple code, but what I did it does not create views
in the database and also does not present an error to my despair.
The function is:
def cria_view(self):
cursor = self.connectBanco()
sql = "CREATE OR REPLACE VIEW espacial.teste AS SELECT *FROM espacial.fx_pedestre;"
cursor.execute(sql)
Here I call the method:
instancia_sql.cria_view()
With this same SQL I create the view by the Query of Postgresql, but the function in Python does not create, but also does not give error. Does anyone know why? Am I missing something?