12
12
from dbt .contracts .connection import AdapterResponse
13
13
from dbt .contracts .connection import Connection
14
14
from dbt .exceptions import (
15
- DatabaseException ,
16
- FailedToConnectException ,
17
- RuntimeException
15
+ DbtDatabaseError ,
16
+ FailedToConnectError ,
17
+ DbtRuntimeError
18
18
)
19
19
from dbt .logger import GLOBAL_LOGGER as logger
20
20
@@ -66,7 +66,7 @@ def open(cls, connection: Connection):
66
66
handle : sqlite3 .Connection = sqlite3 .connect (schemas_and_paths ['main' ])
67
67
attached .append (schemas_and_paths ['main' ])
68
68
else :
69
- raise FailedToConnectException ("at least one schema must be called 'main'" )
69
+ raise FailedToConnectError ("at least one schema must be called 'main'" )
70
70
71
71
if len (credentials .extensions ) > 0 :
72
72
handle .enable_load_extension (True )
@@ -92,7 +92,7 @@ def open(cls, connection: Connection):
92
92
if schema not in attached :
93
93
cursor .execute (f"attach '{ path } ' as '{ schema } '" )
94
94
else :
95
- raise FailedToConnectException (
95
+ raise FailedToConnectError (
96
96
f"found { path } while scanning schema_directory, but cannot attach it as '{ schema } ' " +
97
97
f"because that schema name is already defined in schemas_and_paths. " +
98
98
f"fix your ~/.dbt/profiles.yml file" )
@@ -112,7 +112,7 @@ def open(cls, connection: Connection):
112
112
connection .handle = None
113
113
connection .state = "fail"
114
114
115
- raise FailedToConnectException (str (e ))
115
+ raise FailedToConnectError (str (e ))
116
116
except Exception as e :
117
117
print (f"Unknown error opening SQLite connection: { e } " )
118
118
raise e
@@ -151,12 +151,12 @@ def exception_handler(self, sql: str):
151
151
except sqlite3 .DatabaseError as e :
152
152
self .release ()
153
153
logger .debug ("sqlite3 error: {}" .format (str (e )))
154
- raise DatabaseException (str (e ))
154
+ raise DbtDatabaseError (str (e ))
155
155
except Exception as e :
156
156
logger .debug ("Error running SQL: {}" .format (sql ))
157
157
logger .debug ("Rolling back transaction." )
158
158
self .release ()
159
- raise RuntimeException (str (e ))
159
+ raise DbtRuntimeError (str (e ))
160
160
161
161
def add_query (
162
162
self ,
0 commit comments