On Tue, Jun 12, 2018 at 6:25 PM, jamesmf <jamesmfr...@gmail.com> wrote: > Hi all, > > Has anyone found a solution to this issue when using CTEs inside an insert > statement in Oracle? > > https://stackoverflow.com/questions/45899044/sqlalchemy-with-clause-cte-with-insert-is-not-compiling-correctly-for-oracle > > The CTEs show up above the insert statement rather than following it. > > I couldn't find an issue for it on bitbucket, but I don't trust my search > skills.
bitbucket's issue search is awful so I google like this: site:https://bitbucket.org/zzzeek/sqlalchemy oracle cte this issue seems familiar but I can't find any issues or PRs addressing it. There's no dialect-specific logic for CTEs with INSERT so the base compiler would need to hook out for integration points on this as well as have new tests for it. Additionally we would need to know what the syntax for UPDATE and DELETE ctes looks like. I'm inclined to keep the base output the way it is, I notice someone refers to the SQL standard that the WITH is on the inside, but...the whole world of CTE users especially with INSERT are doing it with Postgresql. Didn't know oracle supported this. the comments on the SO issue are a year old so someone should have reported an issue or helped with a PR by now, the implementation here isn't that hard to do. to do it on the outside is possible though would be pretty ugly. as always you'd be looking at a @compiles recipe: http://docs.sqlalchemy.org/en/latest/core/compiler.html but as far as strategy, maybe breaking up the INSERT into its components and rendering them separately....not really sure. Posting the issue and even better helping with a PR would lead to a better end result :) > > Thanks, > > James > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > 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 https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- 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 https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.