(row, tbl, pkey_list = None, field_map = None)
return "insert into %s (%s) values (%s);" % (
                    skytools.quote_fqident(tbl), col_str, val_str)
Generate INSERT statement from dict data.

    >>> mk_insert_sql({'id': '1', 'data': None}, 'tbl')
    "insert into public.tbl (data, id) values (null, '1');"
Generate INSERT statement from dict data.
Generate INSERT statement from dict data .
def mk_insert_sql(row, tbl, pkey_list = None, field_map = None):
    """Generate INSERT statement from dict data.

    >>> mk_insert_sql({'id': '1', 'data': None}, 'tbl')
    "insert into public.tbl (data, id) values (null, '1');"
    """

    col_list = []
    val_list = []
    if field_map:
        for src, dst in field_map.iteritems():
            col_list.append(skytools.quote_ident(dst))
            val_list.append(skytools.quote_literal(row[src]))
    else:
        for c, v in row.iteritems():
            col_list.append(skytools.quote_ident(c))
            val_list.append(skytools.quote_literal(v))
    col_str = ", ".join(col_list)
    val_str = ", ".join(val_list)
    return "insert into %s (%s) values (%s);" % (
                    skytools.quote_fqident(tbl), col_str, val_str)
def mk_insert_sql ( row , tbl , pkey_list = None , field_map = None ) : col_list = [ ] val_list = [ ] if field_map : for src , dst in field_map . iteritems ( ) : col_list . append ( skytools . quote_ident ( dst ) ) val_list . append ( skytools . quote_literal ( row [ src ] ) ) else : for c , v in row . iteritems ( ) : col_list . append ( skytools . quote_ident ( c ) ) val_list . append ( skytools . quote_literal ( v ) ) col_str = ", " . join ( col_list ) val_str = ", " . join ( val_list ) return "insert into %s (%s) values (%s);" % ( skytools . quote_fqident ( tbl ) , col_str , val_str )