-
Notifications
You must be signed in to change notification settings - Fork 122
Expand file tree
/
Copy pathbase.py
More file actions
77 lines (55 loc) · 1.76 KB
/
base.py
File metadata and controls
77 lines (55 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import TYPE_CHECKING, Protocol
from dbt_mcp.config.headers import (
HeadersProvider,
ProxiedToolHeadersProvider,
TokenProvider,
)
if TYPE_CHECKING:
from dbt_mcp.config.settings import DbtMcpSettings
class CredentialsProviderProtocol(Protocol):
"""Structural interface for credential providers.
Both CredentialsProvider and ElicitingCredentialsProvider satisfy this
protocol. Config providers accept this protocol so either can be injected.
"""
async def get_credentials(self) -> tuple[DbtMcpSettings, TokenProvider]: ...
class ConfigProvider[ConfigType](ABC):
@abstractmethod
async def get_config(self) -> ConfigType: ...
class MultiProjectConfigProvider[ConfigType](ABC):
@abstractmethod
async def get_config(self, project_id: int) -> ConfigType: ...
class StaticConfigProvider[T](ConfigProvider[T]):
def __init__(self, config: T):
self.config = config
async def get_config(self) -> T:
return self.config
@dataclass
class AdminApiConfig:
url: str
headers_provider: HeadersProvider
account_id: int
prod_environment_id: int | None = None
@dataclass
class DiscoveryConfig:
url: str
headers_provider: HeadersProvider
environment_id: int
@dataclass
class ProxiedToolConfig:
user_id: int | None
dev_environment_id: int | None
prod_environment_id: int | None
url: str
headers_provider: ProxiedToolHeadersProvider
@dataclass
class SemanticLayerConfig:
url: str
host: str
prod_environment_id: int
token_provider: TokenProvider
headers_provider: HeadersProvider
metrics_related_max: int = 10
max_response_chars: int = 16000