import os

class CreateTables:
    def __init__(self,pgconn):
        self._pgconn = pgconn
        self._cursor = pgconn.cursor

    def executeQuery(self):
        dir_path = os.path.dirname(os.path.realpath(__file__))
        dir_file = os.path.join(dir_path, "sql/CreateTables.sql")
        with open(dir_file, 'r') as myfile:
            data = myfile.read()

        self._cursor.execute(data)
        self._pgconn.connection.commit()
        count = self._cursor.rowcount
        print (count, "Record inserted successfully into the table")