MCPcopy Create free account
hub / github.com/SeldonIO/seldon-server / create_schema

Function create_schema

python/seldon/shell/attr_schema_utils.py:169–191  ·  view source on GitHub ↗
(client_name, dbSettings, scheme_file_path, clean=False)

Source from the content-addressed store, hash-verified

167 cur.execute('truncate table item_map_text')
168
169def create_schema(client_name, dbSettings, scheme_file_path, clean=False):
170
171 if clean != True:
172 json_data=open(scheme_file_path)
173 data = json.load(json_data)
174 if 'types' not in data:
175 print "couldn't find types object in json"
176 return
177 else:
178 types = readTypes(data['types'])
179
180 db = MySQLdb.connect(user=dbSettings["user"],db=client_name,passwd=dbSettings["password"], host=dbSettings["host"])
181 if clean == True:
182 clearUp(db)
183 print "Finished cleaning attributes successfully"
184 else:
185 addToDb(db, types)
186 f = open('dimensions.json','w')
187 outputDimensionsToFile(f,db)
188
189 print 'Finished applying attributes successfully'
190
191 json_data.close()
192

Callers

nothing calls this directly

Calls 6

readTypesFunction · 0.70
clearUpFunction · 0.70
addToDbFunction · 0.70
outputDimensionsToFileFunction · 0.70
loadMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected