Skip to content
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

Added support for CosmosDB v4 extension #175

Merged
merged 4 commits into from
Apr 27, 2023
Merged

Conversation

gavin-aguiar
Copy link
Contributor

@gavin-aguiar gavin-aguiar commented Apr 26, 2023

Added support for cosmos db v4 extension for the new programming model.

New decorators for cosmosdb:

Extension 2.x and 3.x

  • cosmos_db_trigger_v3
  • cosmos_db_input_v3
  • cosmos_db_output_v3

Extension 4.x and above

  • cosmos_db_trigger
  • cosmos_db_input
  • cosmos_db_output

The new v4 cosmos db extension installation can be found here

The latest support configurations for the new programming model can be found here

@codecov
Copy link

codecov bot commented Apr 26, 2023

Codecov Report

Merging #175 (80dff21) into dev (deafb79) will increase coverage by 0.23%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##              dev     #175      +/-   ##
==========================================
+ Coverage   90.28%   90.51%   +0.23%     
==========================================
  Files          53       53              
  Lines        3046     3122      +76     
  Branches      809      815       +6     
==========================================
+ Hits         2750     2826      +76     
  Misses        219      219              
  Partials       77       77              
Flag Coverage Δ
unittests 90.48% <100.00%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
azure/functions/decorators/cosmosdb.py 100.00% <100.00%> (ø)
azure/functions/decorators/function_app.py 99.25% <100.00%> (+0.05%) ⬆️

@gavin-aguiar gavin-aguiar marked this pull request as ready for review April 26, 2023 21:06
Copy link
Member

@vrdmr vrdmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Thanks for the fast turn over!

@@ -106,3 +107,103 @@ def __init__(self,
self.database_name = database_name
self.collection_name = collection_name
super().__init__(name=name, data_type=data_type)


class CosmosDBInput(InputBinding):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the comments, could you please add a description of what is the difference between CosmosDBTriggerV3 vs CosmosDBTrigger so that that info is in the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

CosmosDB data is changed.
indexing model. This decorator will work only with extension bundle 2.x
or 3.x. For additional details, please refer
https://github.com/Azure/azure-functions-python-worker/issues/1222.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not put an aka.ms link or mslearn link? aka.ms can be tracked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

All optional fields will be given default value by function host when
they are parsed by function host.

Ref: https://aka.ms/azure-function-binding-cosmosdb-v2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might need another aka.ms link which pivots to
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comments to the other decorators as well.

@gavin-aguiar gavin-aguiar merged commit 27bead7 into dev Apr 27, 2023
@gavin-aguiar gavin-aguiar deleted the gaaguiar/cosmosdb_v4 branch April 27, 2023 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants