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

    def insertQuery(self, query):
        try:
            self._cursor.execute(query)
            self._pgconn.connection.commit()
            count = self._cursor.rowcount
            return count
        except Exception as ex :
            print("ERROR: ", type(ex), ex.args)
            return None

    def getUuID(self):
        try:
            self._cursor.execute('SELECT  uuid_generate_v4() as id;')
            self._pgconn.connection.commit()
            result = self._cursor.fetchall()
            return result[0][0]
        except Exception as ex :
            print("ERROR: ", type(ex), ex.args)
            return None
    