@@ -201,6 +201,7 @@ def _build_spark_relation_list(
201201 self ,
202202 row_list : "agate.Table" ,
203203 relation_info_func : Callable [["agate.Row" ], RelationInfo ],
204+ schema_relation : Optional [BaseRelation ] = None ,
204205 ) -> List [BaseRelation ]:
205206 """Aggregate relations with format metadata included."""
206207 relations = []
@@ -217,6 +218,7 @@ def _build_spark_relation_list(
217218 is_iceberg : bool = "Provider: iceberg" in information
218219
219220 relation : BaseRelation = self .Relation .create (
221+ database = schema_relation .database if schema_relation else None ,
220222 schema = _schema ,
221223 identifier = name ,
222224 type = rel_type ,
@@ -241,6 +243,7 @@ def list_relations_without_caching(self, schema_relation: BaseRelation) -> List[
241243 return self ._build_spark_relation_list (
242244 row_list = show_table_extended_rows ,
243245 relation_info_func = self ._get_relation_information ,
246+ schema_relation = schema_relation ,
244247 )
245248 except DbtRuntimeError as e :
246249 errmsg = getattr (e , "msg" , "" )
@@ -258,6 +261,7 @@ def list_relations_without_caching(self, schema_relation: BaseRelation) -> List[
258261 return self ._build_spark_relation_list (
259262 row_list = show_table_rows ,
260263 relation_info_func = self ._get_relation_information_using_describe ,
264+ schema_relation = schema_relation ,
261265 )
262266 except DbtRuntimeError as e :
263267 description = "Error while retrieving information about"
@@ -270,9 +274,6 @@ def list_relations_without_caching(self, schema_relation: BaseRelation) -> List[
270274 return []
271275
272276 def get_relation (self , database : str , schema : str , identifier : str ) -> Optional [BaseRelation ]:
273- if not self .Relation .get_default_include_policy ().database :
274- database = None # type: ignore
275-
276277 return super ().get_relation (database , schema , identifier )
277278
278279 def parse_describe_extended (
0 commit comments