Skip to content

feat: support CosmosDB SDK-type bindings #109

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

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
Open

Conversation

EvanR-Dev
Copy link
Contributor

@EvanR-Dev EvanR-Dev commented Apr 11, 2025

Allow customers to bind to CosmosClient, ContainerProxy, and DatabaseProxy from the azure-cosmos SDK.

@EvanR-Dev EvanR-Dev marked this pull request as ready for review April 14, 2025 16:54


@app.route(route="container")
@app.cosmos_db_input(arg_name="container",
Copy link
Contributor

Choose a reason for hiding this comment

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

rename to docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But these aren't docs right? The arg_name is the name of the client being used at the time for the deferred binding. E.g. container is for the name of the ContainerProxy client coming from the SDK. I feel we keep this or even rename all arg_names to client

)
self.assertEqual(
e.exception.args[0],
"Storage account connection string NotARealConnectionString does not exist. "
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be Cosmos DB connection string. How did this test pass?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for the below tests

Copy link
Contributor

Choose a reason for hiding this comment

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

Right now the structure is to create a new unit test pipeline for each extension, which needs to be done in ADO, so these tests haven't actually been run anywhere yet. The idea was to maintain separation between the extensions, but it's become more of a hassle when adding new extensions.

Might be worth it to combine every unit test pipeline into one single pipeline so we don't run into this issue again

Copy link
Contributor Author

@EvanR-Dev EvanR-Dev Apr 25, 2025

Choose a reason for hiding this comment

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

Yes - some of the current tests won't pass locally as they require specific setup as well before running (i.e. Env vars)


class CosmosClientConverter(
InConverter,
OutConverter,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is OutConverter needed here?

USAGE:
Set the environment variables with your own values before running the
sample:
1) AzureWebJobsStorage - the connection string to your storage account
Copy link
Contributor

@hallvictoria hallvictoria Apr 29, 2025

Choose a reason for hiding this comment

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

This should be CosmosDBConnection right? The connection string to the cosmosdb resource. Same for all samples

"Values": {
"FUNCTIONS_WORKER_RUNTIME": "python",
"CosmosDBConnection": ""
}
Copy link
Contributor

@hallvictoria hallvictoria Apr 29, 2025

Choose a reason for hiding this comment

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

(I could be wrong) I think AzureWebJobsStorage is a required setting -- we can add it but set it to LocalDev. Same for all samples

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