-
Notifications
You must be signed in to change notification settings - Fork 67
Add LeasesTableName to SqlTriggerAttribute #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b432c31
addLeasesTableNameSetting to SqlTriggerAttribute
lucyzhang929 e30538e
add provider test
lucyzhang929 97a6f27
add samples
lucyzhang929 51bdb0a
remove setting
lucyzhang929 a7d0073
add new constructor
lucyzhang929 e7048c7
fix metrics provider
lucyzhang929 557e462
add integration test
lucyzhang929 454665c
fix oop
lucyzhang929 d6498b5
fix test
lucyzhang929 af00b1d
cleanup + pr comments
lucyzhang929 a33cc13
quote escape leasestablename
lucyzhang929 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
samples/samples-csharp/TriggerBindingSamples/ProductsTriggerLeasesTableName.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
|
||
| using System.Collections.Generic; | ||
| using Microsoft.Azure.WebJobs.Extensions.Sql.Samples.Common; | ||
| using Microsoft.Extensions.Logging; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace Microsoft.Azure.WebJobs.Extensions.Sql.Samples.TriggerBindingSamples | ||
| { | ||
| public static class ProductsTriggerLeasesTableName | ||
| { | ||
| [FunctionName(nameof(ProductsTriggerLeasesTableName))] | ||
| public static void Run( | ||
| [SqlTrigger("[dbo].[Products]", "SqlConnectionString", "Leases")] | ||
| IReadOnlyList<SqlChange<Product>> changes, | ||
| ILogger logger) | ||
| { | ||
| logger.LogInformation("SQL Changes: " + JsonConvert.SerializeObject(changes)); | ||
| } | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
samples/samples-csx/ProductsTriggerLeasesTableName/function.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "name": "changes", | ||
| "type": "sqlTrigger", | ||
| "direction": "in", | ||
| "tableName": "dbo.Products", | ||
| "connectionStringSetting": "SqlConnectionString", | ||
| "leasesTableName": "Leases" | ||
| } | ||
| ], | ||
| "disabled": false | ||
| } |
14 changes: 14 additions & 0 deletions
14
samples/samples-csx/ProductsTriggerLeasesTableName/run.csx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| #load "../Common/product.csx" | ||
| #r "Newtonsoft.Json" | ||
| #r "Microsoft.Azure.WebJobs.Extensions.Sql" | ||
|
|
||
| using System.Net; | ||
| using Microsoft.AspNetCore.Mvc; | ||
| using Microsoft.Extensions.Primitives; | ||
| using Newtonsoft.Json; | ||
| using Microsoft.Azure.WebJobs.Extensions.Sql; | ||
|
|
||
| public static void Run(IReadOnlyList<SqlChange<Product>> changes, ILogger log) | ||
| { | ||
| log.LogInformation("SQL Changes: " + JsonConvert.SerializeObject(changes)); | ||
| } |
13 changes: 13 additions & 0 deletions
13
samples/samples-js/ProductsTriggerLeasesTableName/function.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "name": "changes", | ||
| "type": "sqlTrigger", | ||
| "direction": "in", | ||
| "tableName": "dbo.Products", | ||
| "connectionStringSetting": "SqlConnectionString", | ||
| "leasesTableName": "Leases" | ||
| } | ||
| ], | ||
| "disabled": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
|
||
| module.exports = async function (context, changes) { | ||
| context.log(`SQL Changes: ${JSON.stringify(changes)}`) | ||
| } |
29 changes: 29 additions & 0 deletions
29
samples/samples-outofproc/TriggerBindingSamples/ProductsTriggerLeasesTableName.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
|
||
| using System.Collections.Generic; | ||
| using Microsoft.Azure.Functions.Worker; | ||
| using Microsoft.Azure.Functions.Worker.Extensions.Sql; | ||
| using Microsoft.Azure.WebJobs.Extensions.Sql.SamplesOutOfProc.Common; | ||
| using Microsoft.Extensions.Logging; | ||
| using Newtonsoft.Json; | ||
| using System; | ||
|
|
||
| namespace Microsoft.Azure.WebJobs.Extensions.Sql.SamplesOutOfProc.TriggerBindingSamples | ||
| { | ||
| public class ProductsTriggerLeasesTableName | ||
| { | ||
| private static readonly Action<ILogger, string, Exception> _loggerMessage = LoggerMessage.Define<string>(LogLevel.Information, eventId: new EventId(0, "INFO"), formatString: "{Message}"); | ||
|
|
||
| [Function("ProductsTriggerLeasesTableName")] | ||
| public static void Run( | ||
| [SqlTrigger("[dbo].[Products]", "SqlConnectionString", "Leases")] | ||
| IReadOnlyList<SqlChange<Product>> changes, FunctionContext context) | ||
| { | ||
| if (changes != null && changes.Count > 0) | ||
| { | ||
| _loggerMessage(context.GetLogger("ProductsTriggerLeasesTableName"), "SQL Changes: " + JsonConvert.SerializeObject(changes), null); | ||
| } | ||
| } | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
samples/samples-powershell/ProductsTriggerLeasesTableName/function.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "name": "changes", | ||
| "type": "sqlTrigger", | ||
| "direction": "in", | ||
| "tableName": "dbo.Products", | ||
| "connectionStringSetting": "SqlConnectionString", | ||
| "leasesTableName": "Leases" | ||
| } | ||
| ], | ||
| "disabled": false | ||
| } |
9 changes: 9 additions & 0 deletions
9
samples/samples-powershell/ProductsTriggerLeasesTableName/run.ps1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
|
||
| using namespace System.Net | ||
|
|
||
| param($changes) | ||
|
|
||
| $changesJson = $changes | ConvertTo-Json -Compress | ||
| Write-Host "SQL Changes: $changesJson" |
8 changes: 8 additions & 0 deletions
8
samples/samples-python/ProductsTriggerLeasesTableName/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| import json | ||
| import logging | ||
|
|
||
| def main(changes): | ||
| logging.info("SQL Changes: %s", json.loads(changes)) |
13 changes: 13 additions & 0 deletions
13
samples/samples-python/ProductsTriggerLeasesTableName/function.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "bindings": [ | ||
| { | ||
| "name": "changes", | ||
| "type": "sqlTrigger", | ||
| "direction": "in", | ||
| "tableName": "dbo.Products", | ||
| "connectionStringSetting": "SqlConnectionString", | ||
| "leasesTableName": "Leases" | ||
| } | ||
| ], | ||
| "disabled": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.