Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/BindingsOverview.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [Input Binding](#input-binding)
- [Retry support for Input Bindings](#retry-support-for-input-bindings)
- [Output Binding](#output-binding)
- [Output Binding columns](#output-binding-columns)
- [Primary Key Special Cases](#primary-key-special-cases)
- [Identity Columns](#identity-columns)
- [Columns with Default Values](#columns-with-default-values)
Expand All @@ -26,12 +27,18 @@ Azure SQL Output bindings take a list of rows and upserts them to the user table

> **NOTE:** By default the Output binding uses the T-SQL [MERGE](https://docs.microsoft.com/sql/t-sql/statements/merge-transact-sql) statement which requires [SELECT](https://docs.microsoft.com/sql/t-sql/statements/merge-transact-sql#permissions) permissions on the target database.

### Output Binding columns

When generating the queries used to upsert values into the database, the binding will first generate a list of columns to insert from the input data. For in-proc .NET Functions this is the POCO object used in the binding attribute. For all other languages this list is generated by looking at the first item of the input data and using the columns specified there.

The result is that the binding expects all objects to have every column defined - even optional columns. If this is not the case then it will likely result in some column values being ignored if they aren't included in the first item in the row. Optional columns should pass a null value (or the language equivalent) in rows that don't have a value for that column.

### Primary Key Special Cases

Typically Output Bindings require two things :

1. The table being upserted to contains a Primary Key constraint (composed of one or more columns)
2. Each of those columns must be present in the POCO object used in the attribute
2. Each of those columns must be present in the column list generated for the function

Normally either of these are false then an error will be thrown. Below are the situations in which this is not the case :

Expand Down