How do I get tables in postgres using psycopg2?

后端 未结 5 545
再見小時候
再見小時候 2021-01-31 01:48

Can someone please explain how I can get the tables in the current database?

I am using postgresql-8.4 psycopg2.

5条回答
  •  难免孤独
    2021-01-31 02:22

    If you use psql, you can type:

    \d
    

    http://www.postgresql.org/docs/9.1/static/app-psql.html

    If you are running SQL, you can type:

    SELECT * FROM tables;
    

    http://www.postgresql.org/docs/current/interactive/information-schema.html

    If you want statistics about their usage, you can type:

    SELECT * FROM pg_stat_user_tables;
    

    http://www.postgresql.org/docs/current/interactive/monitoring-stats.html

提交回复
热议问题