Basic logic on Python OOP
<p>I have studied Python and understand how the OOP concept work.  The doubt I have is how to implement in a application that has sql interaction..</p>

<p>Assume I have a employee table in SQL which contains Emp name, Emp address , Emp Salary..Now, I need to give a salary raise for all the employees for which I create a class with a method.</p>

<p>My Database logic</p>

<pre><code>db = MySQLdb.connect("localhost","testuser","test123","TESTDB" )

cursor = db.cursor()

sql = "Select * from Emp"
cursor.execute(sql)
results = cursor.fetchall()

for row in results:
     name = row[0]
     address = row[1]
     salary  = row[2]



db.close()
</code></pre>

<p>Class definiton:</p>

<pre><code>   Class Emp():
      def __init__(self,name,salary):
            self.name = name
            self.salary = salary
      def giveraise(self):
            self.salary = self.salary*1.4
</code></pre>

<p>How do I create the object with the details fetched from the Employee table...I know you don't need to create a class to perform this small operation..but Im thinking in the lines of practical implementation.</p>

<p>I need to process record by record.</p>
