使用pyodbc冻结并不删除行来删除行

2024-04-25 10:05:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在编写一个脚本来从sqlazure数据库中删除行。当我在Jupyter笔记本中执行这个脚本时,它将永远运行,并且从不删除行。你知道为什么这个脚本没有执行吗?你知道吗

    key = input("Enter key to remove\n")  

    cnxn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+'; UID='+username+';PWD='+ password)
    cursor = cnxn.cursor()

    sql = "DELETE FROM Customer where CustomerID like '{key}%'"
    process = sql.format(key = key)
    cursor.execute(process)
    cursor.commit()

Tags: tokey脚本数据库inputsql笔记本jupyter