Spaces:
Runtime error
Runtime error
Mayuresh Agashe
commited on
Commit
·
67c6678
1
Parent(s):
33115fa
Mark singleton connection class not singleton for testing SQL serevr's timeout period
Browse files
TechdocsAPI/backend/utils/DBConnection.py
CHANGED
@@ -22,17 +22,17 @@ class DBConnection:
|
|
22 |
If the client instance is already created, then it does not create a
|
23 |
new client instance.
|
24 |
"""
|
25 |
-
if DBConnection.__client is not None:
|
26 |
-
|
27 |
-
else:
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
|
37 |
@staticmethod # A static method is a method that is called without creating an instance of the class.
|
38 |
def get_client():
|
|
|
22 |
If the client instance is already created, then it does not create a
|
23 |
new client instance.
|
24 |
"""
|
25 |
+
# if DBConnection.__client is not None:
|
26 |
+
# raise Exception("This class is a singleton!")
|
27 |
+
# else:
|
28 |
+
creds={
|
29 |
+
'host':config.HOSTNAME,
|
30 |
+
'user':config.UID,
|
31 |
+
'password':config.PASSWORD,
|
32 |
+
'database':config.DATABASE
|
33 |
+
}
|
34 |
+
DBConnection.__client = mysql.connector.connect(**creds)
|
35 |
+
DBConnection._flag = True
|
36 |
|
37 |
@staticmethod # A static method is a method that is called without creating an instance of the class.
|
38 |
def get_client():
|