Using pypika to generate SQL Server query with an "OUTPUT" clause

716 views Asked by At

I am using pypika to build queries that will be sent to SQL Server. SQL Server has an OUTPUT clause that I would like to include in the query to return the uniqueidentifier that will be generated by default on an INSERT. pypika does not have any built-in functionality for adding an OUTPUT clause to the query.

Is there any way to generate a query containing an OUTPUT clause with pypika?

Example of the type of query I am trying to generate:

INSERT INTO Table (Name, Email) 
OUTPUT INSERTED.Id, INSERTED.Name, INSERTED.Email 
VALUES ('name', 'email');

edit: fixed example query syntax

0

There are 0 answers