postgresql – Modify owners in all tables. How to run a selected query?

I need to write a script which modifies all table owners in a Cloud SQL Postgre db. So far I have gotten this far:

SELECT format(
        'ALTER TABLE %I.%I.%I OWNER TO %I gexec;',
        table_catalog,
        table_schema,
        table_name,
        {new_user}  
        )
        FROM information_schema.tables
        WHERE table_schema = 'mySchema';
        ''')

It returns the right commands like:ALTER TABLE schema_version OWNER TO ali;

ALTER TABLE .. OWNER TO ..;
ALTER TABLE .. OWNER TO ..;

But how do I run these now? My code is below. Ask you kindly to provide any suggestions!

import sqlalchemy ​ 
    """ Connect to the PostgreSQL database server """
    conn = None
    try: ​
        # connect to the PostgreSQL server
        print('Connecting to the PostgreSQL database...')     ​
        db_url = 'postgresql+psycopg2://{}:{}@{}:{}/{}'.format(
        username, password, host, port, database) ​
        engine = sqlalchemy.create_engine(db_url) ​
        conn = engine.connect()
    # create a cursor
        cur = conn.cursor()
            # execute a statement
        print('Reassigning the owners:')
        cur.execute(
        '''
        SELECT format(
        'ALTER TABLE %I.%I.%I OWNER TO %I gexec;',
        table_catalog,
        table_schema,
        table_name,
        {new_user}  
        )
        FROM information_schema.tables
        WHERE table_schema = 'mySchema';
        ''') ​
        # commit the changes to the DB
        con.commit()
        print("The owner has been altered successfully")