def _sql_expand_insert(self, spec, key_prefix = '', col_prefix = ''):
        """ Expand a dict so it fits in a INSERT clause
        """
        col = list(spec)
        sql = '('
        sql += ', '.join(col_prefix + key for key in col)
        sql += ') VALUES ('
        sql += ', '.join('%(' + key_prefix + key + ')s' for key in col)
        sql += ')'
        params = {}
        for key in spec:
            params[key_prefix + key] = spec[key]

        return sql, params
def _sql_expand_insert ( self , spec , key_prefix = '' , col_prefix = '' ) : col = list ( spec ) sql = '(' sql += ', ' . join ( col_prefix + key for key in col ) sql += ') VALUES (' sql += ', ' . join ( '%(' + key_prefix + key + ')s' for key in col ) sql += ')' params = { } for key in spec : params [ key_prefix + key ] = spec [ key ] return sql , params
Expand a dict so it fits in a INSERT clause