import psycopg2

from config import DATABASE
from db_utils import clear_tables, drop_tables

if __name__ == "__main__":
    con = psycopg2.connect(**DATABASE)
    with con.cursor() as cursor:
        try:
            clear_tables(cursor)
            drop_tables(cursor)
            con.commit()
        finally:
            if con:
                con.close()

Exemple #2
0
 def tearDown(self) -> None:
     with self.conn.cursor() as cursor:
         clear_tables(cursor)
         drop_tables(cursor)
     self.conn.commit()
     self.conn.close()