Exemplo n.º 1
0
 def setUp(self) -> None:
     self.conn = psycopg2.connect(**TEST_DATABASE)
     with self.conn.cursor() as cursor:
         cursor.execute("SET LOCAL lc_monetary = 'en_US.UTF-8';")
         init_tables(cursor)
         fill_tables(cursor)
     self.conn.commit()
Exemplo n.º 2
0
 def setUp(self) -> None:
     self.conn = psycopg2.connect(**TEST_DATABASE)
     with self.conn.cursor() as cursor:
         init_tables(cursor)
         fill_tables(cursor)
     self.conn.commit()
Exemplo n.º 3
0
import psycopg2

from config import DATABASE
from db_utils import init_tables, fill_tables

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