Skip to content

Commit 5ab2b06

Browse files
Update docs with details about output binding columns (#889)
1 parent 1e70db7 commit 5ab2b06

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/BindingsOverview.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- [Input Binding](#input-binding)
88
- [Retry support for Input Bindings](#retry-support-for-input-bindings)
99
- [Output Binding](#output-binding)
10+
- [Output Binding columns](#output-binding-columns)
1011
- [Primary Key Special Cases](#primary-key-special-cases)
1112
- [Identity Columns](#identity-columns)
1213
- [Columns with Default Values](#columns-with-default-values)
@@ -26,12 +27,18 @@ Azure SQL Output bindings take a list of rows and upserts them to the user table
2627

2728
> **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.
2829
30+
### Output Binding columns
31+
32+
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.
33+
34+
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.
35+
2936
### Primary Key Special Cases
3037

3138
Typically Output Bindings require two things :
3239

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

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

0 commit comments

Comments
 (0)