14
14
from collections import OrderedDict
15
15
from concurrent .futures import Future
16
16
from dataclasses import dataclass
17
- from typing import Optional , List , Dict , Any , Union , Iterable
17
+ from typing import Optional , List , Dict , Any , Union , Iterable , FrozenSet , Tuple
18
18
import agate
19
19
20
20
import dbt
23
23
from dbt .adapters .base import AdapterConfig
24
24
from dbt .adapters .base .impl import catch_as_completed
25
25
from dbt .adapters .sql import SQLAdapter
26
+ from dbt .adapters .contracts .relation import RelationConfig
26
27
27
28
import dbt .adapters .hive .cloudera_tracking as tracker
28
29
from dbt .adapters .hive import HiveConnectionManager
29
30
from dbt .adapters .hive import HiveRelation
30
31
from dbt .adapters .hive import HiveColumn
31
32
from dbt .adapters .base import BaseRelation
32
- from dbt .utils import executor
33
+ from dbt_common .utils import executor
33
34
34
- from dbt .clients import agate_helper
35
+ from dbt_common .clients import agate_helper
35
36
36
- from dbt .events import AdapterLogger
37
+ from dbt .adapters . events . logging import AdapterLogger
37
38
38
39
logger = AdapterLogger ("Hive" )
39
40
@@ -347,9 +348,11 @@ def get_properties(self, relation: Relation) -> Dict[str, str]:
347
348
)
348
349
return dict (properties )
349
350
350
- def get_catalog (self , manifest ):
351
+ def get_catalog (
352
+ self , relation_configs : Iterable [RelationConfig ], used_schemas : FrozenSet [Tuple [str , str ]]
353
+ ):
351
354
"""Return a catalogs that contains information of all schemas"""
352
- schema_map = self ._get_catalog_schemas (manifest )
355
+ schema_map = self ._get_catalog_schemas (relation_configs )
353
356
if len (schema_map ) > 1 :
354
357
dbt .exceptions .raise_compiler_error (
355
358
f"Expected only one database in get_catalog, found " f"{ list (schema_map )} "
@@ -361,14 +364,7 @@ def get_catalog(self, manifest):
361
364
for info , schemas in schema_map .items ():
362
365
for schema in schemas :
363
366
futures .append (
364
- tpe .submit_connected (
365
- self ,
366
- schema ,
367
- self ._get_one_catalog ,
368
- info ,
369
- [schema ],
370
- manifest ,
371
- )
367
+ tpe .submit_connected (self , schema , self ._get_one_catalog , info , [schema ])
372
368
)
373
369
# at this point all catalogs in futures list will be merged into one
374
370
# insides`catch_on_completed` method of the parent class
@@ -388,12 +384,7 @@ def get_catalog(self, manifest):
388
384
389
385
return catalogs , exceptions
390
386
391
- def _get_one_catalog (
392
- self ,
393
- information_schema ,
394
- schemas ,
395
- manifest ,
396
- ) -> agate .Table :
387
+ def _get_one_catalog (self , information_schema , schemas ) -> agate .Table :
397
388
"""Get ONE catalog. Used by get_catalog
398
389
399
390
manifest is used to run the method in other context's
0 commit comments