Hi, using sqlalchemy 1.0.9 and python 2.7.10. import sqlalchemy as sa
meta = sa.MetaData() table = sa.Table('mytable', meta, sa.Column('foo', sa.String), sa.Column('bar', sa.String, default='baz'), ) select = sa.select([table.c.foo]) insert = table.insert().from_select(['foo'], select, include_defaults=True) print insert print insert $ python insert_with_default.py INSERT INTO mytable (foo, bar) SELECT mytable.foo, :bar AS anon_1 FROM mytable Traceback (most recent call last): File "insert_with_default.py", line 13, in <module> print insert File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 506, in __str__ return unicode(self.compile()).encode('ascii', 'backslashreplace') File "<string>", line 1, in <lambda> File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 494, in compile return self._compiler(dialect, bind=bind, **kw) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 500, in _compiler return dialect.statement_compiler(dialect, self, **kw) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 392, in __init__ Compiled.__init__(self, dialect, statement, **kwargs) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 190, in __init__ self.string = self.process(self.statement, **compile_kwargs) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 213, in process return obj._compiler_dispatch(self, **kwargs) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch return meth(self, **kw) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 1883, in visit_insert text += " %s" % self.process(self._insert_from_select, **kw) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 213, in process return obj._compiler_dispatch(self, **kwargs) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch return meth(self, **kw) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 1580, in visit_select for name, column in select._columns_plus_names File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 1352, in _label_select_column **column_clause_args File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 81, in _compiler_dispatch return meth(self, **kw) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 612, in visit_label OPERATORS[operators.as_] + \ File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/visitors.py", line 93, in _compiler_dispatch return meth(self, **kw) File "/Users/jon/.virtualenvs/s-pyline/lib/python2.7/site-packages/sqlalchemy/sql/compiler.py", line 1089, in visit_bindparam (bindparam.key, bindparam.key) sqlalchemy.exc.CompileError: bindparam() name 'bar' is reserved for automatic usage in the VALUES or SET clause of this insert/update statement. Please use a name other than column name when using bindparam() with insert() or update() (for example, 'b_bar'). -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.