-
Notifications
You must be signed in to change notification settings - Fork 26
/
fabric_credentials.py
69 lines (61 loc) · 1.85 KB
/
fabric_credentials.py
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
from dataclasses import dataclass
from typing import Optional
from dbt.contracts.connection import Credentials
@dataclass
class FabricCredentials(Credentials):
driver: str
host: str
database: str
schema: str
port: Optional[int] = 1433
UID: Optional[str] = None
PWD: Optional[str] = None
windows_login: Optional[bool] = False
tenant_id: Optional[str] = None
client_id: Optional[str] = None
client_secret: Optional[str] = None
authentication: Optional[str] = "sql"
encrypt: Optional[bool] = True # default value in MS ODBC Driver 18 as well
trust_cert: Optional[bool] = False # default value in MS ODBC Driver 18 as well
retries: int = 1
schema_authorization: Optional[str] = None
login_timeout: Optional[int] = 0
query_timeout: Optional[int] = 0
_ALIASES = {
"user": "UID",
"username": "UID",
"pass": "PWD",
"password": "PWD",
"server": "host",
"trusted_connection": "windows_login",
"auth": "authentication",
"app_id": "client_id",
"app_secret": "client_secret",
"TrustServerCertificate": "trust_cert",
"schema_auth": "schema_authorization",
}
@property
def type(self):
return "fabric"
def _connection_keys(self):
# return an iterator of keys to pretty-print in 'dbt debug'
# raise NotImplementedError
if self.windows_login is True:
self.authentication = "Windows Login"
return (
"server",
"database",
"schema",
"port",
"UID",
"client_id",
"authentication",
"encrypt",
"trust_cert",
"retries",
"login_timeout",
"query_timeout",
)
@property
def unique_field(self):
return self.host