title: Unable to execute Postgres queries in Python
body: <p>I'm trying to create a Postgres table using psycopg2 in Python as follows:</p>
  
  <pre><code>import psycopg2
  
  class DbOperations (object):
  
  def __init__(self):
  
      self.dummy = None
      self.conn = None
      self.cur = None
      self.query = None
      self.db_name = "alarm_log"
      self.table_name = "alarms"
      self.user = "cayman"
      self.password = "admin"
      self.host = "127.0.0.1"
  
  def db_connect(self):
  
      self.conn = psycopg2.connect(dbname=self.db_name, user=self.user, password=self.password, host=self.host)
      self.cur = self.conn.cursor()
  
  def db_disconnect(self):
  
      self.conn.close()
  
  def db_create_table(self):
  
      self.query ="""
                  CREATE TABLE COMPANY(
             ID INT PRIMARY KEY     NOT NULL,
             NAME           TEXT    NOT NULL,
             AGE            INT     NOT NULL,
             ADDRESS        CHAR(50),
             SALARY         REAL
          );
      """
      print (self.query)
      self.cur.execute(self.query)
  </code></pre>
  
  <p>Then I construct the object as follows:</p>
  
  <pre><code>db_app = DbOperations()
  db_app.db_connect()
  db_app.db_create_table()
  </code></pre>
  
  <p>I am able to manually connect to the database and create the table. However, I'm not able to do so using Python. 
  There are no exceptions or error messages. When I try to list the tables in the database manually, I don't find my newly created table.
  Any suggestions what could be wrong ?</p>