@@ -88,6 +88,9 @@ class DriverFeatures:
8888 statement_prepare : bool = True
8989 _current_catalog : str | FromEnv | None = None
9090 _current_schema : str | FromEnv | None = None
91+ _secondary_schema : str | FromEnv | None = None
92+ _secondary_catalog : str | FromEnv | None = None
93+ _secondary_catalog_schema : str | FromEnv | None = None
9194 supported_xdbc_fields : list [str ] = dataclasses .field (default_factory = list )
9295
9396 def __init__ (
@@ -104,6 +107,9 @@ def __init__(
104107 statement_prepare = True ,
105108 current_catalog = None ,
106109 current_schema = None ,
110+ secondary_schema = None ,
111+ secondary_catalog = None ,
112+ secondary_catalog_schema = None ,
107113 supported_xdbc_fields = None ,
108114 ):
109115 self .connection_get_table_schema = connection_get_table_schema
@@ -117,6 +123,9 @@ def __init__(
117123 self .statement_prepare = statement_prepare
118124 self ._current_catalog = current_catalog
119125 self ._current_schema = current_schema
126+ self ._secondary_schema = secondary_schema
127+ self ._secondary_catalog = secondary_catalog
128+ self ._secondary_catalog_schema = secondary_catalog_schema
120129 self .supported_xdbc_fields = supported_xdbc_fields or []
121130
122131 @property
@@ -131,6 +140,24 @@ def current_schema(self) -> str | None:
131140 return self ._current_schema .get_or_raise ()
132141 return self ._current_schema
133142
143+ @property
144+ def secondary_schema (self ) -> str | None :
145+ if isinstance (self ._secondary_schema , FromEnv ):
146+ return self ._secondary_schema .get_or_raise ()
147+ return self ._secondary_schema
148+
149+ @property
150+ def secondary_catalog (self ) -> str | None :
151+ if isinstance (self ._secondary_catalog , FromEnv ):
152+ return self ._secondary_catalog .get_or_raise ()
153+ return self ._secondary_catalog
154+
155+ @property
156+ def secondary_catalog_schema (self ) -> str | None :
157+ if isinstance (self ._secondary_catalog_schema , FromEnv ):
158+ return self ._secondary_catalog_schema .get_or_raise ()
159+ return self ._secondary_catalog_schema
160+
134161
135162class DriverQuirks (abc .ABC ):
136163 @property
@@ -149,7 +176,13 @@ def bind_parameter(self, index: int) -> str:
149176 return "?"
150177
151178 def drop_table (
152- self , * , table_name : str , if_exists : bool = True , temporary : bool = False
179+ self ,
180+ * ,
181+ table_name : str ,
182+ schema_name : str | None = None ,
183+ catalog_name : str | None = None ,
184+ if_exists : bool = True ,
185+ temporary : bool = False ,
153186 ) -> str :
154187 """
155188 Drop a table.
@@ -160,17 +193,27 @@ def drop_table(
160193 The cursor to execute the query.
161194 table_name : str
162195 The name of the table to drop.
196+ schema_name : str, optional
197+ The schema containing the table (if not given, assume current
198+ schema).
199+ catalog_name : str, optional
200+ The catalog containing the table (if not given, assume current
201+ catalog).
163202 if_exists : bool
164203 If True, do not raise an error if the table does not exist.
165204 temporary : bool
166205 If True, the table is a temporary table.
167206 """
168207 if temporary :
169208 raise NotImplementedError
209+
210+ name = "." .join (
211+ [part for part in (catalog_name , schema_name , table_name ) if part ]
212+ )
170213 if if_exists :
171- return f"DROP TABLE IF EXISTS { table_name } "
214+ return f"DROP TABLE IF EXISTS { name } "
172215 else :
173- return f"DROP TABLE { table_name } "
216+ return f"DROP TABLE { name } "
174217
175218 @abc .abstractmethod
176219 def is_table_not_found (self , table_name : str , error : Exception ) -> bool :
0 commit comments