]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- use inline=True for the insert..select here so it works on oracle
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 12 Jul 2013 16:14:50 +0000 (12:14 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 12 Jul 2013 16:15:39 +0000 (12:15 -0400)
lib/sqlalchemy/sql/expression.py
lib/sqlalchemy/testing/suite/test_insert.py

index 7cb1326e2f06e0f14209125e0868111832fcc0ba..45341bba75e42b3b6f105660a0352bb5b7d53835 100644 (file)
@@ -6364,6 +6364,17 @@ class Insert(ValuesBase):
          would normally raise an exception if these column lists don't
          correspond.
 
+        .. note::
+
+           Depending on backend, it may be necessary for the :class:`.Insert`
+           statement to be constructed using the ``inline=True`` flag; this
+           flag will prevent the implicit usage of ``RETURNING`` when the
+           ``INSERT`` statement is rendered, which isn't supported on a backend
+           such as Oracle in conjunction with an ``INSERT..SELECT`` combination::
+
+             sel = select([table1.c.a, table1.c.b]).where(table1.c.c > 5)
+             ins = table2.insert(inline=True).from_select(['a', 'b'], sel)
+
         .. versionadded:: 0.8.3
 
         """
index ef05291b5b51e35785f94406c0ded1e277c3663e..e671eeb7a2f4516e868845e9df06eaac2d1edd2a 100644 (file)
@@ -135,9 +135,9 @@ class InsertBehaviorTest(fixtures.TablesTest):
 
 
         config.db.execute(
-                table.insert().
+                table.insert(inline=True).
                     from_select(
-                        ("data",), select([table.c.data]).where(
+                        ("id", "data",), select([table.c.id + 5, table.c.data]).where(
                                 table.c.data.in_(["data2", "data3"]))
                     ),
         )