PostgresOSM.table_exists¶
-
PostgresOSM.
table_exists
(table_name, schema_name='public')¶ Check if a table exists in the database being connected.
- Parameters
table_name (str) – name of a table
schema_name (str) – name of a schema, defaults to
'public'
- Returns
True
if the table exists,False
otherwise- Return type
bool
Examples:
>>> from pyhelpers.sql import PostgreSQL >>> testdb = PostgreSQL('localhost', 5432, username='postgres', database_name='testdb') Password (postgres@localhost:5432): *** Connecting postgres:***@localhost:5432/testdb ... Successfully. >>> testdb.table_exists(table_name='England', schema_name='points') >>> # (if 'points.England' does not exist) False >>> # Delete the database "testdb" >>> testdb.drop_database(verbose=True) To drop the database "testdb" from postgres:***@localhost:5432 ? [No]|Yes: yes Dropping "testdb" ... Done.