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