Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Worker.Extensions.Sql/src/SqlTriggerAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public SqlTriggerAttribute(string tableName, string connectionStringSetting) : t
/// Name of the table used to store leases.
/// If not specified, the leases table name will be Leases_{FunctionId}_{TableId}
/// More information on how this is generated can be found here
/// https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleases_
/// https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleasestablename
/// </summary>
public string LeasesTableName { get; }
}
Expand Down
4 changes: 2 additions & 2 deletions docs/BindingsOverview.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ If an exception occurs in the user function when processing changes then the bat

If the function execution fails 5 times in a row for a given row then that row is completely ignored for all future changes. Because the rows in a batch are not deterministic, rows in a failed batch may end up in different batches in subsequent invocations. This means that not all rows in the failed batch will necessarily be ignored. If other rows in the batch were the ones causing the exception, the "good" rows may end up in a different batch that doesn't fail in future invocations.

You can run this query to see what rows have failed 5 times and are currently ignored, see [Leases table](./TriggerBinding.md#az_funcleases_) documentation for how to get the correct Leases table to query for your function.
You can run this query to see what rows have failed 5 times and are currently ignored, see [Leases table](./TriggerBinding.md#az_funcleasestablename) documentation for how to get the correct Leases table to query for your function.

```sql
SELECT * FROM [az_func].[Leases_<FunctionId>_<TableId>] WHERE _az_func_AttemptCount = 5
Expand All @@ -173,7 +173,7 @@ UPDATE [Products].[az_func].[Leases_<FunctionId>_<TableId>] SET _az_func_Attempt

#### Lease Tables clean up

Before clean up, please see [Leases table](./TriggerBinding.md#az_funcleases_) documentation for understanding how they are created and used.
Before clean up, please see [Leases table](./TriggerBinding.md#az_funcleasestablename) documentation for understanding how they are created and used.

Why clean up?
1. You renamed your function/class/method name, which causes a new lease table to be created and the old one to be obsolete.
Expand Down
3 changes: 2 additions & 1 deletion docs/SetupGuide_Dotnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,11 @@ See [Trigger Binding Overview](./BindingsOverview.md#trigger-binding) for genera

### SqlTriggerAttribute

The SqlAttribute for Trigger bindings takes two [arguments](https://github.com/Azure/azure-functions-sql-extension/blob/main/src/TriggerBinding/SqlTriggerAttribute.cs)
The SqlAttribute for Trigger bindings takes three [arguments](https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/src/TriggerBinding/SqlTriggerAttribute.cs)

- **TableName**: Represents the name of the table to be monitored for changes.
- **ConnectionStringSetting**: Specifies the name of the app setting that contains the SQL connection string used to connect to a database. The connection string must follow the format specified [here](https://docs.microsoft.com/dotnet/api/microsoft.data.sqlclient.sqlconnection.connectionstring?view=sqlclient-dotnet-core-2.0).
- **LeasesTableName**: Optional. Name of the table used to store leases. If not specified, the leases table name will be Leases_{FunctionId}_{TableId}. More information on how this is generated can be found [here](https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleasestablename).

The trigger binding can bind to type `IReadOnlyList<SqlChange<T>>`:

Expand Down
1 change: 1 addition & 0 deletions docs/SetupGuide_DotnetCSharpScript.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ The following table explains the binding configuration properties that you set i
|**name** | Required. The name of the variable that represents the set of changes that triggered the function code. Must be set to `changes`. |
| **tableName** | Required. The name of the table to be monitored for changes. |
| **connectionStringSetting** | Required. The name of an app setting that contains the SQL connection string used to connect to a database. The connection string must follow the format specified [here](https://docs.microsoft.com/dotnet/api/microsoft.data.sqlclient.sqlconnection.connectionstring?view=sqlclient-dotnet-core-2.0). |
| **leasesTableName** | Optional. The name of the table used to store leases. If not specified, the leases table name will be Leases_{FunctionId}_{TableId}. More information on how this is generated can be found [here](https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleasestablename).|

### Setup for Trigger Bindings

Expand Down
1 change: 1 addition & 0 deletions docs/SetupGuide_DotnetOutOfProc.md
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ The SqlAttribute for Trigger bindings takes two [arguments](https://github.com/A

- **TableName**: Represents the name of the table to be monitored for changes.
- **ConnectionStringSetting**: Specifies the name of the app setting that contains the SQL connection string used to connect to a database. The connection string must follow the format specified [here](https://docs.microsoft.com/dotnet/api/microsoft.data.sqlclient.sqlconnection.connectionstring?view=sqlclient-dotnet-core-2.0).
- **LeasesTableName**: Optional. Name of the table used to store leases. If not specified, the leases table name will be Leases_{FunctionId}_{TableId}. More information on how this is generated can be found [here](https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleasestablename).

The trigger binding can bind to type `IReadOnlyList<SqlChange<T>>`:

Expand Down
1 change: 1 addition & 0 deletions docs/SetupGuide_Java.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ In the Java functions runtime library, use the @SQLTrigger annotation (com.micro
| **name** | Required. The name of the parameter that the trigger binds to. |
| **tableName** | Required. The name of the table monitored by the trigger. |
| **connectionStringSetting** | Required. The name of an app setting that contains the connection string for the database containing the table monitored for changes. This isn't the actual connection string and must instead resolve to an environment variable. Optional keywords in the connection string value are [available to refine SQL bindings connectivity](https://aka.ms/sqlbindings#sql-connection-string). |
| **leasesTableName** | Optional. The name of the table used to store leases. If not specified, the leases table name will be Leases_{FunctionId}_{TableId}. More information on how this is generated can be found [here](https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleasestablename).|

When you're developing locally, add your application settings in the local.settings.json file in the Values collection.
### Setup for Trigger Bindings
Expand Down
3 changes: 2 additions & 1 deletion docs/SetupGuide_Javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ The following table explains the binding configuration properties that you set i
| **name** | Required. The name of the parameter that the trigger binds to. |
| **type** | Required. Must be set to `sqlTrigger`.|
| **direction** | Required. Must be set to `in`. |
| **commandText** | Required. The name of the table being monitored by the trigger. |
| **tableName** | Required. The name of the table being monitored by the trigger. |
| **connectionStringSetting** | Required. The name of an app setting that contains the connection string for the database containing the table monitored for changes. This isn't the actual connection string and must instead resolve to an environment variable. Optional keywords in the connection string value are [available to refine SQL bindings connectivity](https://aka.ms/sqlbindings#sql-connection-string). |
| **leasesTableName** | Optional. The name of the table used to store leases. If not specified, the leases table name will be Leases_{FunctionId}_{TableId}. More information on how this is generated can be found [here](https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleasestablename).|

### Setup for Trigger Bindings

Expand Down
3 changes: 2 additions & 1 deletion docs/SetupGuide_PowerShell.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,9 @@ The following table explains the binding configuration properties that you set i
| **name** | Required. The name of the parameter that the trigger binds to. |
| **type** | Required. Must be set to `sqlTrigger`.|
| **direction** | Required. Must be set to `in`. |
| **commandText** | Required. The name of the table being monitored by the trigger. |
| **tableName** | Required. The name of the table being monitored by the trigger. |
| **connectionStringSetting** | Required. The name of an app setting that contains the connection string for the database containing the table monitored for changes. This isn't the actual connection string and must instead resolve to an environment variable. Optional keywords in the connection string value are [available to refine SQL bindings connectivity](https://aka.ms/sqlbindings#sql-connection-string). |
| **leasesTableName** | Optional. The name of the table used to store leases. If not specified, the leases table name will be Leases_{FunctionId}_{TableId}. More information on how this is generated can be found [here](https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleasestablename).|

### Setup for Trigger Bindings

Expand Down
3 changes: 2 additions & 1 deletion docs/SetupGuide_Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ The following table explains the binding configuration properties that you set i
| **name** | Required. The name of the parameter that the trigger binds to. |
| **type** | Required. Must be set to `sqlTrigger`.|
| **direction** | Required. Must be set to `in`. |
| **commandText** | Required. The name of the table being monitored by the trigger. |
| **tableName** | Required. The name of the table being monitored by the trigger. |
| **connectionStringSetting** | Required. The name of an app setting that contains the connection string for the database containing the table monitored for changes. This isn't the actual connection string and must instead resolve to an environment variable. Optional keywords in the connection string value are [available to refine SQL bindings connectivity](https://aka.ms/sqlbindings#sql-connection-string). |
| **leasesTableName** | Optional. The name of the table used to store leases. If not specified, the leases table name will be Leases_{FunctionId}_{TableId}. More information on how this is generated can be found [here](https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleasestablename).|

### Setup for Trigger Bindings

Expand Down
4 changes: 2 additions & 2 deletions docs/TriggerBinding.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ If the tables are deleted or modified, then unexpected behavior may occur. To re

This table stores information about each function being executed, what table that function is watching and what the [last sync state](https://learn.microsoft.com/sql/relational-databases/track-changes/work-with-change-tracking-sql-server) that has been processed.

### az_func.Leases_*
### az_func.\<LeasesTableName\>

A `Leases_*` table is created for every unique instance of a function and table. The full name will be in the format `Leases_<FunctionId>_<TableId>` where `<FunctionId>` is generated from the function ID and `<TableId>` is the object ID of the table being tracked. Such as `Leases_7d12c06c6ddff24c_1845581613`.
If the [LeasesTableName](https://github.com/Azure/azure-functions-sql-extension/blob/30d361021c6760938db659cbe535a9b4f00fc942/docs/SetupGuide_Dotnet.md#L411) property is defined, `az_func.<LeasesTableName>` is created. If LeasesTableName is not defined, a `Leases_*` table is created for every unique instance of a function and table. The full name will be in the format `Leases_<FunctionId>_<TableId>` where `<FunctionId>` is generated from the function ID and `<TableId>` is the object ID of the table being tracked. Such as `Leases_7d12c06c6ddff24c_1845581613`.

To find the name of the leases table associated with your function, look in the log output for a line such as this which is emitted when the trigger is started.

Expand Down
2 changes: 1 addition & 1 deletion src/TriggerBinding/SqlTriggerAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public SqlTriggerAttribute(string tableName, string connectionStringSetting) : t
/// Name of the table used to store leases.
/// If not specified, the leases table name will be Leases_{FunctionId}_{TableId}
/// More information on how this is generated can be found here
/// https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleases_
/// https://github.com/Azure/azure-functions-sql-extension/blob/release/trigger/docs/TriggerBinding.md#az_funcleasestablename
/// </summary>
public string LeasesTableName { get; }
}
Expand Down