| 
						
						
							
								
							
						
						
					 | 
					@ -100,36 +100,38 @@ def sourceTables(request, sourceId): | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      json_data.append(table['fields']) | 
					 | 
					 | 
					      json_data.append(table['fields']) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  except: | 
					 | 
					 | 
					  except: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    source = SourceDataBase.objects.get(source_id=sourceId) | 
					 | 
					 | 
					    print('no linked tables before') | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    source = serializers.serialize('json', [source]) | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    source = json.loads(source)[0]['fields'] | 
					 | 
					 | 
					  source = SourceDataBase.objects.get(source_id=sourceId) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    password = source['password'].encode(('utf-8')) | 
					 | 
					 | 
					  source = serializers.serialize('json', [source]) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    print(password) | 
					 | 
					 | 
					  source = json.loads(source)[0]['fields'] | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    host = source['host'] | 
					 | 
					 | 
					  password = source['password'].encode(('utf-8')) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    username = source['username'] | 
					 | 
					 | 
					  host = source['host'] | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    port = source['port'] | 
					 | 
					 | 
					  username = source['username'] | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    password = pc.decrypt(password) | 
					 | 
					 | 
					  port = source['port'] | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    database = source['database'] | 
					 | 
					 | 
					  password = pc.decrypt(password) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    print(password) | 
					 | 
					 | 
					  database = source['database'] | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    db=_mysql.connect( | 
					 | 
					 | 
					  db=_mysql.connect( | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					      host=host, | 
					 | 
					 | 
					    host=host, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					      port=int(port), | 
					 | 
					 | 
					    port=int(port), | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					      user=username, | 
					 | 
					 | 
					    user=username, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					      passwd=password, | 
					 | 
					 | 
					    passwd=password, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					      db=database, | 
					 | 
					 | 
					    db=database | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					      charset='utf8' | 
					 | 
					 | 
					  ) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    ) | 
					 | 
					 | 
					  db.query('show tables;') | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    db.query('show tables;') | 
					 | 
					 | 
					  tables = db.store_result().fetch_row(maxrows=0, how=2) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    tables = db.store_result().fetch_row(maxrows=0, how=2) | 
					 | 
					 | 
					  db.close() | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    db.close() | 
					 | 
					 | 
					  tables = list(tables) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    json_data = list(tables[0].values()) | 
					 | 
					 | 
					  for i, table in enumerate(tables): | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    for i, table in enumerate(json_data): | 
					 | 
					 | 
					    tableName = list(table.values())[0].decode('utf-8') | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					      json_data[i] = { | 
					 | 
					 | 
					    if next((x for x in json_data if x['table'] == tableName), None): | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        'table': table.decode('utf-8'), | 
					 | 
					 | 
					      print(tableName + ' linked') | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					    else: | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					      json_data.append({ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					        'table': tableName, | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        'status': 0 | 
					 | 
					 | 
					        'status': 0 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					      } | 
					 | 
					 | 
					      }) | 
				
			
			
				
				
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					  return JsonResponse({'code': 20000, 'message': 'success', 'data': json_data }) | 
					 | 
					 | 
					  return JsonResponse({'code': 20000, 'message': 'success', 'data': json_data }) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |