@@ -95,7 +95,7 @@ def compile(
9595 expr : ir .Expr ,
9696 / ,
9797 * ,
98- limit : str | int | None = None ,
98+ limit : int | None = None ,
9999 params : Mapping [ir .Expr , Any ] | None = None ,
100100 pretty : bool = False ,
101101 ) -> str :
@@ -492,7 +492,7 @@ def _build_insert_template(
492492 schema : sch .Schema ,
493493 catalog : str | None = None ,
494494 columns : bool = False ,
495- placeholder : str | Iterable [ str ] = "?" ,
495+ placeholder : str = "?" ,
496496 ) -> str :
497497 """Builds an INSERT INTO table VALUES query string with placeholders.
498498
@@ -644,7 +644,9 @@ def _build_upsert_from_table(
644644 )
645645 return query
646646
647- def truncate_table (self , name : str , / , * , database : str | None = None ) -> None :
647+ def truncate_table (
648+ self , name : str , / , * , database : str | tuple [str , str ] | None = None
649+ ) -> None :
648650 """Delete all rows from a table.
649651
650652 ::: {.callout-note}
@@ -709,13 +711,13 @@ def _to_catalog_db_tuple(self, table_loc: sge.Table):
709711
710712 return sg_cat , sg_db
711713
712- def _to_sqlglot_table (self , database ) :
714+ def _to_sqlglot_table (self , database : None | str | tuple [ str , str ]) -> sge . Table :
713715 quoted = self .compiler .quoted
714716 dialect = self .dialect
715717
716718 if database is None :
717719 # Create "table" with empty catalog and db
718- database = sge .Table (catalog = None , db = None )
720+ sgt = sge .Table (catalog = None , db = None )
719721 elif isinstance (database , (list , tuple )):
720722 if len (database ) > 2 :
721723 raise ValueError (
@@ -734,7 +736,7 @@ def _to_sqlglot_table(self, database):
734736 '\n ("catalog", "database")'
735737 '\n ("database",)'
736738 )
737- database = sge .Table (
739+ sgt = sge .Table (
738740 catalog = sg .to_identifier (catalog , quoted = quoted ),
739741 db = sg .to_identifier (database , quoted = quoted ),
740742 )
@@ -744,28 +746,28 @@ def _to_sqlglot_table(self, database):
744746 # sqlglot parsing of the string will assume that it's a Table
745747 # so we unpack the arguments into a new sqlglot object, switching
746748 # table (this) -> database (db) and database (db) -> catalog
747- table = sg .parse_one (
749+ sgt = sg .parse_one (
748750 "." .join (
749751 sg .to_identifier (part , quoted = quoted ).sql (dialect )
750752 for part in database .split ("." )
751753 ),
752754 into = sge .Table ,
753755 dialect = dialect ,
754756 )
755- if table .args ["catalog" ] is not None :
757+ if sgt .args ["catalog" ] is not None :
756758 raise exc .IbisInputError (
757- f"Overspecified table hierarchy provided: `{ table .sql (dialect )} `"
759+ f"Overspecified table hierarchy provided: `{ sgt .sql (dialect )} `"
758760 )
759- catalog = table .args ["db" ]
760- db = table .args ["this" ]
761- database = sge .Table (catalog = catalog , db = db )
761+ catalog = sgt .args ["db" ]
762+ db = sgt .args ["this" ]
763+ sgt = sge .Table (catalog = catalog , db = db )
762764 else :
763765 raise ValueError (
764766 """Invalid database hierarchy format. Please use either dotted
765767 strings ('catalog.database') or tuples ('catalog', 'database')."""
766768 )
767769
768- return database
770+ return sgt
769771
770772 def _register_builtin_udf (self , udf_node : ops .ScalarUDF ) -> None :
771773 """No-op."""
0 commit comments