(row, tbl, pkey_list, field_map = None)
return "delete from only %s where %s;" % (skytools.quote_fqident(tbl), whe_str)
Generate DELETE statement from dict data.
Generate DELETE statement from dict data.
Generate DELETE statement from dict data .
def mk_delete_sql(row, tbl, pkey_list, field_map = None):
    """Generate DELETE statement from dict data."""

    if len(pkey_list) < 1:
        raise Exception("delete needs pkeys")
    whe_list = []
    for k in pkey_list:
        new_k = field_map and field_map[k] or k
        col = skytools.quote_ident(new_k)
        val = skytools.quote_literal(row[k])
        whe_list.append("%s = %s" % (col, val))
    whe_str = " and ".join(whe_list)
    return "delete from only %s where %s;" % (skytools.quote_fqident(tbl), whe_str)
def mk_delete_sql ( row , tbl , pkey_list , field_map = None ) : if len ( pkey_list ) < 1 : raise Exception ( "delete needs pkeys" ) whe_list = [ ] for k in pkey_list : new_k = field_map and field_map [ k ] or k col = skytools . quote_ident ( new_k ) val = skytools . quote_literal ( row [ k ] ) whe_list . append ( "%s = %s" % ( col , val ) ) whe_str = " and " . join ( whe_list ) return "delete from only %s where %s;" % ( skytools . quote_fqident ( tbl ) , whe_str )