File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 44from flask_restful import reqparse , abort , Api , Resource
55import json
66import pyodbc
7+ import threading
78
89# Initialize Flask
910app = Flask (__name__ )
1314parser = reqparse .RequestParser ()
1415parser .add_argument ('customer' )
1516
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+
1631class Queryable (Resource ):
1732 def executeQueryJson (self , verb , payload = None ):
1833 result = {}
19- conn = pyodbc . connect ( os . environ [ 'SQLAZURECONNSTR_WWIF' ] )
34+ conn = getConnection ( )
2035 cursor = conn .cursor ()
2136 entity = type (self ).__name__ .lower ()
2237 procedure = f"web.{ verb } _{ entity } "
You can’t perform that action at this time.
0 commit comments