How do I get tables in postgres using psycopg2?

postgresql-8.4, psycopg2, python

Solution

This did the trick for me:

cursor.execute("""SELECT table_name FROM information_schema.tables
       WHERE table_schema = 'public'""")
for table in cursor.fetchall():
    print(table)

Problem

Can someone please explain how I can get the tables in the current database? I am using postgresql-8.4 psycopg2.

Original source