File tree 1 file changed +16
-1
lines changed
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 4
4
from flask_restful import reqparse , abort , Api , Resource
5
5
import json
6
6
import pyodbc
7
+ import threading
7
8
8
9
# Initialize Flask
9
10
app = Flask (__name__ )
13
14
parser = reqparse .RequestParser ()
14
15
parser .add_argument ('customer' )
15
16
17
+ conn_index = 0
18
+ conn_list = list ()
19
+
20
+ for c in range (10 ):
21
+ conn = pyodbc .connect (os .environ ['SQLAZURECONNSTR_WWIF' ])
22
+ conn_list .append (conn )
23
+
24
+ def getConnection ():
25
+ global conn_index
26
+ conn_index += 1
27
+ if conn_index > 9 :
28
+ conn_index = 0
29
+ return conn_list [conn_index ]
30
+
16
31
class Queryable (Resource ):
17
32
def executeQueryJson (self , verb , payload = None ):
18
33
result = {}
19
- conn = pyodbc . connect ( os . environ [ 'SQLAZURECONNSTR_WWIF' ] )
34
+ conn = getConnection ( )
20
35
cursor = conn .cursor ()
21
36
entity = type (self ).__name__ .lower ()
22
37
procedure = f"web.{ verb } _{ entity } "
You can’t perform that action at this time.
0 commit comments