File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,11 @@ def _exists(self, snapshot):
77
77
:rtype: bool
78
78
:returns: True if the table exists, else false.
79
79
"""
80
+ if (
81
+ self ._database .database_dialect
82
+ == DatabaseDialect .DATABASE_DIALECT_UNSPECIFIED
83
+ ):
84
+ self ._database .reload ()
80
85
if self ._database .database_dialect == DatabaseDialect .POSTGRESQL :
81
86
results = snapshot .execute_sql (
82
87
_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):
29
29
assert not table .exists ()
30
30
31
31
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
+
32
42
def test_db_list_tables (shared_database ):
33
43
tables = shared_database .list_tables ()
34
44
table_ids = set (table .table_id for table in tables )
You can’t perform that action at this time.
0 commit comments