This repository was archived by the owner on Mar 31, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,6 +77,11 @@ def _exists(self, snapshot):
7777 :rtype: bool
7878 :returns: True if the table exists, else false.
7979 """
80+ if (
81+ self ._database .database_dialect
82+ == DatabaseDialect .DATABASE_DIALECT_UNSPECIFIED
83+ ):
84+ self ._database .reload ()
8085 if self ._database .database_dialect == DatabaseDialect .POSTGRESQL :
8186 results = snapshot .execute_sql (
8287 _EXISTS_TEMPLATE .format ("WHERE TABLE_NAME = $1" ),
Original file line number Diff line number Diff line change @@ -29,6 +29,16 @@ def test_table_exists_not_found(shared_database):
2929 assert not table .exists ()
3030
3131
32+ def test_table_exists_reload_database_dialect (
33+ shared_instance , shared_database , not_emulator
34+ ):
35+ database = shared_instance .database (shared_database .database_id )
36+ assert database .database_dialect == DatabaseDialect .DATABASE_DIALECT_UNSPECIFIED
37+ table = database .table ("all_types" )
38+ assert table .exists ()
39+ assert database .database_dialect != DatabaseDialect .DATABASE_DIALECT_UNSPECIFIED
40+
41+
3242def test_db_list_tables (shared_database ):
3343 tables = shared_database .list_tables ()
3444 table_ids = set (table .table_id for table in tables )
You can’t perform that action at this time.
0 commit comments