import pymysql
import snowflake
from faker import Faker
fake = Faker('zh_CN')
import random
# 创建数据库连接
conn = pymysql.connect(
host='11.1.1.5',
user='root',
password='@HXYD1109mysql',
database='school_server',
charset='utf8'
)
# 创建游标对象
cursor = conn.cursor()
def create_table(cursor,result):
    
    data = []
    for i in result:
        list_list = list(i)
        des=cursor.description  # 获取表详情，字段名，长度，属性等
        t = ",".join([item[0] for item in des])
        table_head = t.split(',')  # # 查询表列名 用,分割
    
        dict_result = dict(zip(table_head, list_list))  # 打包为元组的列表 再转换为字典
        data.append(dict_result)  # 将字典添加到list_result中
    return data