This repository was archived by the owner on May 17, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,9 @@ def explain_as_text(self, query: str) -> str:
9393 return f"EXPLAIN (FORMAT TEXT) { query } "
9494
9595 def type_repr (self , t ) -> str :
96+ if isinstance (t , TimestampTZ ):
97+ return f"timestamp with time zone"
98+
9699 try :
97100 return {float : "REAL" }[t ]
98101 except KeyError :
@@ -141,11 +144,6 @@ def set_timezone_to_utc(self) -> str:
141144 def current_timestamp (self ) -> str :
142145 return "current_timestamp"
143146
144- def type_repr (self , t ) -> str :
145- if isinstance (t , TimestampTZ ):
146- return f"timestamp with time zone"
147- return super ().type_repr (t )
148-
149147
150148class Presto (Database ):
151149 dialect = Dialect ()
Original file line number Diff line number Diff line change @@ -73,6 +73,24 @@ def test_table_list(self):
7373 db .query (tbl .drop ())
7474 assert not db .query (q )
7575
76+ def test_type_mapping (self ):
77+ name = "tbl_" + random_table_suffix ()
78+ db = get_conn (self .db_cls )
79+ tbl = table (db .parse_table_name (name ), schema = {
80+ "int" : int ,
81+ "float" : float ,
82+ "datetime" : datetime ,
83+ "str" : str ,
84+ "bool" : bool ,
85+ })
86+ q = db .dialect .list_tables (db .default_schema , name )
87+ assert not db .query (q )
88+
89+ db .query (tbl .create ())
90+ self .assertEqual (db .query (q , List [str ]), [name ])
91+
92+ db .query (tbl .drop ())
93+ assert not db .query (q )
7694
7795@test_each_database
7896class TestQueries (unittest .TestCase ):
You can’t perform that action at this time.
0 commit comments