def tables(self, schema=None):
        """Returns a list of tables contained in the database to which the
        class is currently attached.

        If specified, schemas should be an iterable of schemas from which the
        tables should be gathered.
        """
        sql = '''select tablename
                 from pg_tables
        '''
        if schema:
            sql += "where schemaname = %s"
        cursor = self.conn.cursor()
        cursor.execute(sql, (schema, ))
        result = cursor.fetchall()
        return [i[0] for i in result]
Returns a list of tables contained in the database to which the
        class is currently attached.

        If specified, schemas should be an iterable of schemas from which the
        tables should be gathered.
        
recipes/Python/473834_simple_Object_Relational/recipe-473834.py