def visit_insert(self, insert_stmt, asfrom=False, **kw):
self.stack.append(<EOL>{'<STR_LIT>': set(),<EOL>"<STR_LIT>": set(),<EOL>"<STR_LIT>": insert_stmt})<EOL>self.isinsert = True<EOL>crud_params = crud._get_crud_params(self, insert_stmt, **kw)<EOL>if not crud_params andnot self.dialect.supports_default_values andnot self.dialect.supports_empty_insert:<EOL><INDENT>raise NotImplementedError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % self.dialect.name)<EOL><DEDENT>if insert_stmt._has_multi_parameters:<EOL><INDENT>if not self.dialect.supports_multivalues_insert:<EOL><INDENT>raise NotImplementedError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>" % self.dialect.name)<EOL><DEDENT>crud_params_single = crud_params[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>crud_params_single = crud_params<EOL><DEDENT>preparer = self.preparer<EOL>supports_default_values = self.dialect.supports_default_values<EOL>text = "<STR_LIT>"<EOL>if insert_stmt._prefixes:<EOL><INDENT>text += self._generate_prefixes(insert_stmt,<EOL>insert_stmt._prefixes, **kw)<EOL><DEDENT>text += "<STR_LIT>"<EOL>table_text = preparer.format_table(insert_stmt.table)<EOL>if insert_stmt._hints:<EOL><INDENT>dialect_hints = dict([<EOL>(table, hint_text)<EOL>for (table, dialect), hint_text in<EOL>insert_stmt._hints.items()<EOL>if dialect in ('<STR_LIT:*>', self.dialect.name)<EOL>])<EOL>if insert_stmt.table in dialect_hints:<EOL><INDENT>table_text = self.format_from_hint_text(<EOL>table_text,<EOL>insert_stmt.table,<EOL>dialect_hints[insert_stmt.table],<EOL>True<EOL>)<EOL><DEDENT><DEDENT>text += table_text<EOL>if crud_params_single or not supports_default_values:<EOL><INDENT>text += "<STR_LIT>" % '<STR_LIT:U+002CU+0020>'.join([preparer.format_column(c[<NUM_LIT:0>])<EOL>for c in crud_params_single])<EOL><DEDENT>if self.returning or insert_stmt._returning:<EOL><INDENT>self.returning = self.returning or insert_stmt._returning<EOL>returning_clause = self.returning_clause(<EOL>insert_stmt, self.returning)<EOL>if self.returning_precedes_values:<EOL><INDENT>text += "<STR_LIT:U+0020>" + returning_clause<EOL><DEDENT><DEDENT>if insert_stmt.select is not None:<EOL><INDENT>text += "<STR_LIT>" % self.process(self._insert_from_select, **kw)<EOL><DEDENT>elif not crud_params and supports_default_values:<EOL><INDENT>text += "<STR_LIT>"<EOL><DEDENT>elif insert_stmt._has_multi_parameters:<EOL><INDENT>text += "<STR_LIT>" % (<EOL>"<STR_LIT:U+002CU+0020>".join(<EOL>"<STR_LIT>" % (<EOL>'<STR_LIT:U+002CU+0020>'.join(c[<NUM_LIT:1>] for c in crud_param_set)<EOL>)<EOL>for crud_param_set in crud_params<EOL>)<EOL>)<EOL><DEDENT>else:<EOL><INDENT>text += "<STR_LIT>" %'<STR_LIT:U+002CU+0020>'.join([c[<NUM_LIT:1>] for c in crud_params])<EOL><DEDENT>if self.returning and not self.returning_precedes_values:<EOL><INDENT>text += "<STR_LIT:U+0020>" + returning_clause<EOL><DEDENT>self.stack.pop(-<NUM_LIT:1>)<EOL>return text<EOL>
used to compile <sql.expression.Insert> expressions.

this function wraps insert_from_select statements inside
 parentheses to be conform with earlier versions of CreateDB.