def clear_table ( dbconn , table_name ) : cur = dbconn . cursor ( ) cur . execute ( "DELETE FROM '{name}'" . format ( name = table_name ) ) dbconn . commit ( )
python pyodbc delete table function
Delete all rows from a table : param dbconn : data base connection : param table_name : name of the table : return :
def clear_table(dbconn, table_name):
    """
    Delete all rows from a table
    :param dbconn: data base connection
    :param table_name: name of the table
    :return:
    """
    cur = dbconn.cursor()
    cur.execute("DELETE FROM '{name}'".format(name=table_name))
    dbconn.commit()