Skip to content

Commit 10c3aff

Browse files
committed
Python & NodeJS Build updates
1 parent 145a045 commit 10c3aff

11 files changed

+1156
-701
lines changed

articles/azure-functions/functions-bindings-cosmosdb-v2-input.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,6 +1260,34 @@ This section contains the following examples that read a single document by spec
12601260

12611261
The examples depend on whether you use the [v1 or v2 Python programming model](functions-reference-python.md).
12621262

1263+
### Using SDK-Type Bindings for CosmosDB (Preview)
1264+
This example uses SDK types to directly access the underlying [`CosmosClient`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-cosmosdb/samples/cosmosdb_samples_cosmosclient/function_app.py) object provided by the CosmosDB input binding:
1265+
1266+
The function loops through all the databases and logs their IDs.
1267+
```python
1268+
import logging
1269+
import azure.functions as func
1270+
import azurefunctions.extensions.bindings.cosmosdb as cosmos
1271+
1272+
app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)
1273+
1274+
@app.route(route="cosmos")
1275+
@app.cosmos_db_input(arg_name="client",
1276+
connection="CosmosDBConnection",
1277+
database_name=None,
1278+
container_name=None)
1279+
def get_docs(req: func.HttpRequest, client: cosmos.CosmosClient):
1280+
databases = client.list_databases()
1281+
for db in databases:
1282+
logging.info(f"Found database with ID: {db.get('id')}")
1283+
1284+
return "ok"
1285+
```
1286+
1287+
For examples of using other SDK types, see the [`ContainerProxy`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-cosmosdb/samples/cosmosdb_samples_containerproxy/function_app.py) and [`DatabaseProxy`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-cosmosdb/samples/cosmosdb_samples_databaseproxy/function_app.py) samples. For a step-by-step tutorial on how to include SDK-type bindings in your function app, follow the [Python SDK Bindings for CosmosDB Sample](https://github.com/Azure-Samples/azure-functions-cosmosdb-sdk-bindings-python).
1288+
1289+
To learn more, including what other SDK type bindings are supported, see [SDK type bindings](functions-reference-python.md#sdk-type-bindings).
1290+
12631291
### Queue trigger, look up ID from JSON
12641292

12651293
The following example shows an Azure Cosmos DB input binding. The function reads a single document and updates the document's text value.
@@ -1682,6 +1710,15 @@ Updates to documents are not made automatically upon function exit. To update do
16821710
::: zone-end
16831711
::: zone pivot="programming-language-python"
16841712
Data is made available to the function via a `DocumentList` parameter. Changes made to the document are not automatically persisted.
1713+
Functions also supports Python SDK type bindings for Azure Cosmos, which lets you work with data using these underlying SDK types:
1714+
1715+
+ [`ContainerProxy`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-cosmosdb/samples/cosmosdb_samples_containerproxy/function_app.py)
1716+
+ [`CosmosClient`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-cosmosdb/samples/cosmosdb_samples_cosmosclient/function_app.py)
1717+
+ [`DatabaseProxy`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-cosmosdb/samples/cosmosdb_samples_databaseproxy/function_app.py)
1718+
1719+
> [!IMPORTANT]
1720+
> > Support for CosmosDB SDK types for Python is in Preview and is only supported for the Python v2 programming model. For more information, see [SDK types in Python](./functions-reference-python.md#sdk-type-bindings).
1721+
16851722
::: zone-end
16861723

16871724
[!INCLUDE [functions-cosmosdb-connections](../../includes/functions-cosmosdb-connections.md)]

articles/azure-functions/functions-bindings-cosmosdb-v2.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,27 @@ Earlier versions of extensions in the isolated worker process only support bindi
199199

200200
:::zone-end
201201

202+
::: zone pivot="programming-language-python"
203+
204+
## SDK Binding Types
205+
206+
SDK Type support for Azure Cosmos is in Preview. Follow the [Python SDK Bindings for CosmosDB Sample](https://github.com/Azure-Samples/azure-functions-cosmosdb-sdk-bindings-python) to get started with SDK Types for Cosmos in Python.
207+
> [!IMPORTANT]
208+
> Using SDK type bindings requires the [Python v2 programming model](functions-reference-python.md?pivots=python-mode-decorators#sdk-type-bindings).
209+
210+
---
211+
| Binding | Parameter types | Samples |
212+
|----------------|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
213+
| CosmosDB input | [ContainerProxy],<br/>[CosmosClient],<br/>[DatabaseProxy]<br/> | [`ContainerProxy`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-cosmosdb/samples/cosmosdb_samples_containerproxy/function_app.py),<br/>[`CosmosClient`](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-bindings-cosmosdb/samples/cosmosdb_samples_cosmosclient/function_app.py),<br/>[`DatabaseProxy`](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-bindings-cosmosdb/samples/cosmosdb_samples_databaseproxy/function_app.py)<br/> |
214+
215+
---
216+
217+
[CosmosClient]: /python/api/azure-cosmos/azure.cosmos.cosmosclient?view=azure-python
218+
[DatabaseProxy]: python/api/azure-cosmos/azure.cosmos.databaseproxy?view=azure-python
219+
[ContainerProxy]: /python/api/azure-cosmos/azure.cosmos.containerproxy?view=azure-python
220+
221+
:::zone-end
222+
202223
## Exceptions and return codes
203224

204225
| Binding | Reference |

articles/azure-functions/functions-bindings-service-bus-trigger.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,46 @@ Write-Host "PowerShell ServiceBus queue trigger function processed message: $myS
200200
::: zone-end
201201
::: zone pivot="programming-language-python"
202202

203+
This example uses SDK types to directly access the underlying [`ServiceBusReceivedMessage`](/python/api/azure-servicebus/azure.servicebus.servicebusreceivedmessage?view=azure-python) object provided by the Service Bus trigger:
204+
205+
The function reads various properties of the `ServiceBusReceivedMessage` type and logs them.
206+
```python
207+
import logging
208+
import azure.functions as func
209+
import azurefunctions.extensions.bindings.servicebus as servicebus
210+
211+
app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)
212+
213+
@app.service_bus_queue_trigger(arg_name="receivedmessage",
214+
queue_name="QUEUE_NAME",
215+
connection="SERVICEBUS_CONNECTION")
216+
def servicebus_queue_trigger(receivedmessage: servicebus.ServiceBusReceivedMessage):
217+
logging.info("Python ServiceBus queue trigger processed message.")
218+
logging.info("Receiving: %s\n"
219+
"Body: %s\n"
220+
"Enqueued time: %s\n"
221+
"Lock Token: %s\n"
222+
"Message ID: %s\n"
223+
"Sequence number: %s\n",
224+
receivedmessage,
225+
receivedmessage.body,
226+
receivedmessage.enqueued_time_utc,
227+
receivedmessage.lock_token,
228+
receivedmessage.message_id,
229+
receivedmessage.sequence_number)
230+
```
231+
For more examples using Service Bus SDK types, see the [`ServiceBusReceivedMessage`](https://github.com/Azure/azure-functions-python-extensions/tree/dev/azurefunctions-extensions-bindings-servicebus/samples/servicebus_samples_single) samples. For a step-by-step tutorial on how to include SDK-type bindings in your function app, follow the [Python SDK Bindings for Service Bus Sample](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-servicebus/samples/README.md).
232+
233+
> [!NOTE]
234+
> Known limitations include:
235+
> - The `message` property is not supported.
236+
> - Batch message support is supported with runtime version 4.1039 or greater.
237+
> - Message settlement is not yet supported.
238+
239+
240+
To learn more, including what other SDK type bindings are supported, see [SDK type bindings](functions-reference-python.md#sdk-type-bindings).
241+
242+
203243
The following example demonstrates how to read a Service Bus queue message via a trigger. The example depends on whether you use the [v1 or v2 Python programming model](functions-reference-python.md).
204244

205245
# [v2](#tab/python-v2)
@@ -572,6 +612,15 @@ The Service Bus instance is available via the parameter configured in the *funct
572612
::: zone-end
573613
::: zone pivot="programming-language-python"
574614
The queue message is available to the function via a parameter typed as `func.ServiceBusMessage`. The Service Bus message is passed into the function as either a string or JSON object.
615+
616+
Functions also supports Python SDK type bindings for Azure Service Bus, which lets you work with data using these underlying SDK types:
617+
618+
+ [`ServiceBusReceivedMessage`](/python/api/azure-servicebus/azure.servicebus.servicebusreceivedmessage?view=azure-python)
619+
620+
> [!IMPORTANT]
621+
> Support for Service Bus SDK types support in Python is in Preview and is only supported for the Python v2 programming model. For more information, see [SDK types in Python](./functions-reference-python.md#sdk-type-bindings).
622+
623+
575624
::: zone-end
576625
For a complete example, see [the examples section](#example).
577626

articles/azure-functions/functions-bindings-service-bus.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,25 @@ Functions version 1.x doesn't support isolated worker process. To use the isolat
217217

218218
:::zone-end
219219

220+
::: zone pivot="programming-language-python"
221+
222+
## SDK Binding Types
223+
224+
SDK Types for Azure Service Bus are in Preview. Follow the [Python SDK Bindings for Service Bus Sample](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-servicebus/samples/README.md) to get started with SDK Types for Blob in Python.
225+
> [!IMPORTANT]
226+
> Using SDK type bindings requires the [Python v2 programming model](functions-reference-python.md?pivots=python-mode-decorators#sdk-type-bindings).
227+
228+
---
229+
| Binding | Parameter types | Samples |
230+
|--------------------|-----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
231+
| ServiceBus trigger | [ServiceBusReceivedMessage] | [`ServiceBusReceivedMessage`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-servicebus/samples/servicebus_samples_single/function_app.py) |
232+
233+
---
234+
235+
[ServiceBusReceivedMessage]: /python/api/azure-servicebus/azure.servicebus.servicebusreceivedmessage?view=azure-python
236+
237+
:::zone-end
238+
220239
<a name="host-json"></a>
221240

222241
## host.json settings

articles/azure-functions/functions-bindings-storage-blob-input.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,9 @@ This example uses SDK types to directly access the underlying `BlobClient` objec
221221

222222
:::code language="python" source="~/functions-python-extensions/azurefunctions-extensions-bindings-blob/samples/blob_samples_blobclient/function_app.py" range="9-14,42-52":::
223223

224-
For examples of using other SDK types, see the [`ContainerClient`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-blob/samples/blob_samples_containerclient/function_app.py) and [`StorageStreamDownloader`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-blob/samples/blob_samples_storagestreamdownloader/function_app.py) samples.
224+
For examples of using other SDK types, see the [`ContainerClient`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-blob/samples/blob_samples_containerclient/function_app.py) and [`StorageStreamDownloader`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-blob/samples/blob_samples_storagestreamdownloader/function_app.py) samples. For a step-by-step tutorial on how to include SDK-type bindings in your function app, follow the [Python SDK Bindings for Blob Sample](https://github.com/Azure-Samples/azure-functions-blob-sdk-bindings-python).
225225

226-
To learn more, including how to enable SDK type bindings in your project, see [SDK type bindings](functions-reference-python.md#sdk-type-bindings-preview).
226+
To learn more, including what other SDK type bindings are supported, see [SDK type bindings](functions-reference-python.md#sdk-type-bindings).
227227

228228
The code creates a copy of a blob.
229229

@@ -482,9 +482,12 @@ Functions also supports Python SDK type bindings for Azure Blob storage, which l
482482
+ [`ContainerClient`](/python/api/azure-storage-blob/azure.storage.blob.containerclient)
483483
+ [`StorageStreamDownloader`](/python/api/azure-storage-blob/azure.storage.blob.storagestreamdownloader)
484484

485+
> [!NOTE]
486+
> Only synchronous SDK types are supported.
487+
485488
> [!IMPORTANT]
486-
> SDK types support for Python is currently in preview and is only supported for the Python v2 programming model. For more information, see [SDK types in Python](./functions-reference-python.md#sdk-type-bindings-preview).
487-
::: zone-end
489+
> > SDK types support for Python is Generally Available and is only supported for the Python v2 programming model. For more information, see [SDK types in Python](./functions-reference-python.md#sdk-type-bindings).
490+
> ::: zone-end
488491
489492
[!INCLUDE [functions-storage-blob-connections](../../includes/functions-storage-blob-connections.md)]
490493

articles/azure-functions/functions-bindings-storage-blob-trigger.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,9 @@ This example uses SDK types to directly access the underlying [`BlobClient`](/py
178178

179179
:::code language="python" source="~/functions-python-extensions/azurefunctions-extensions-bindings-blob/samples/blob_samples_blobclient/function_app.py" range="9-14,31-39":::
180180

181-
For examples of using other SDK types, see the [`ContainerClient`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-blob/samples/blob_samples_containerclient/function_app.py) and [`StorageStreamDownloader`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-blob/samples/blob_samples_storagestreamdownloader/function_app.py) samples.
181+
For examples of using other SDK types, see the [`ContainerClient`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-blob/samples/blob_samples_containerclient/function_app.py) and [`StorageStreamDownloader`](https://github.com/Azure/azure-functions-python-extensions/blob/dev/azurefunctions-extensions-bindings-blob/samples/blob_samples_storagestreamdownloader/function_app.py) samples. For a step-by-step tutorial on how to include SDK-type bindings in your function app, follow the [Python SDK Bindings for Blob Sample](https://github.com/Azure-Samples/azure-functions-blob-sdk-bindings-python).
182182

183-
To learn more, including how to enable SDK type bindings in your project, see [SDK type bindings](functions-reference-python.md#sdk-type-bindings-preview).
183+
To learn more, including what other SDK type bindings are supported, see [SDK type bindings](functions-reference-python.md#sdk-type-bindings).
184184

185185
This example logs information from the incoming blob metadata.
186186

@@ -463,8 +463,11 @@ Functions also supports Python SDK type bindings for Azure Blob storage, which l
463463
+ [`ContainerClient`](/python/api/azure-storage-blob/azure.storage.blob.containerclient)
464464
+ [`StorageStreamDownloader`](/python/api/azure-storage-blob/azure.storage.blob.storagestreamdownloader)
465465

466+
> [!NOTE]
467+
> Only synchronous SDK types are supported.
468+
466469
> [!IMPORTANT]
467-
> SDK types support for Python is currently in preview and is only supported for the Python v2 programming model. For more information, see [SDK types in Python](./functions-reference-python.md#sdk-type-bindings-preview).
470+
> SDK types support for Python is Generally Available and is only supported for the Python v2 programming model. For more information, see [SDK types in Python](./functions-reference-python.md#sdk-type-bindings).
468471
469472
::: zone-end
470473

0 commit comments

Comments
 (0)