<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_activity_by_id(self, activity_id):
 """ Obtains activity data by it's id. As the activity is unique, it returns a tuple like: (name, category_id). If there is no activity with id == activity_id, a NoHamsterData exception will be raise """


        columns = 'name, category_id'

        query = "SELECT %s FROM activities WHERE id = %s"
        result = self._query(query % (columns, activity_id))

        if result:
            return result[0]  # there only one fact with the id
        else:
            raise NoHamsterData('activities', activity_id)