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

Cosmos: Support trigger execution #19944

Open
JohnGalt1717 opened this issue Feb 15, 2020 · 5 comments
Open

Cosmos: Support trigger execution #19944

JohnGalt1717 opened this issue Feb 15, 2020 · 5 comments
Assignees
Labels
area-cosmos consider-for-current-release customer-reported punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Milestone

Comments

@JohnGalt1717
Copy link

It is my understanding that CosmosDb has no way to turn triggers on by default. They have to be turned on per call. EF Core doesn't turn these on, so triggers can't be used with EF Core. While I understand the separate request for the change feed, I'm referring to built in triggers.

This prevents basic house keeping operations on nosql databases because of no joins. Typically you have data that is a subset of a referenced entity. This happens everywhere, but without triggers you can't update all of those references with the new subset of data of any of those fields change in the database. I.e. if I have a contact, and it's referenced somewhere else, I might include the Name and Email of that contact in some other container that has has a contact associated with it so that you can query and pull all of the information needed about that contact for display without having to separately query for the contacts and join it in memory.

If you have triggers, you can setup your contacts table to, by default, update all of the references in all other containers/objects when those fields change and update the reference information as necessary.

Without them, you have to do this logic in your C# logic every time you update the contact in every single case which is non-optimal and causes a major amount of maintenance code and risk in your C# code that should be managed by the datastore itself.

I would like EF Fluent instructions to allow turning on triggers and defining the triggers that are executed by default. These might be Azure Function triggers, or they could be native cosmosdb triggers, doesn't really matter, we just need to be able to turn them on.
Further there should be an extension method that allows disabling them temporarily for batch operations etc.

Without this functionality you're not properly separating data store functions from data access functions.

@ajcvickers
Copy link
Member

Team notes: putting this on the backlog to track using triggers in Cosmos. Note that we currently have no plans to support creation of triggers for Cosmos in EF Core.

@JohnGalt1717
Copy link
Author

I'm not asking to create triggers. I'm asking to ensure that already created triggers actually fire, which they don't appear to at the moment.

@AndriySvyryd
Copy link
Member

Note to implementor: See how to run triggers

@AndriySvyryd AndriySvyryd changed the title CosmosDb + Triggers enabled Cosmos: Support trigger execution Feb 19, 2020
@robrow01
Copy link

Any updates on this? We need to be able to execute triggers Pre/Post at time of insert/update.

@AndriySvyryd
Copy link
Member

@robrow01 This is currently in the Backlog milestone, meaning we aren't actively working on it.

@ajcvickers ajcvickers modified the milestones: Backlog, 7.0.0 Oct 27, 2021
@ajcvickers ajcvickers modified the milestones: 7.0.0, Backlog Aug 10, 2022
@ajcvickers ajcvickers added the punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. label Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-cosmos consider-for-current-release customer-reported punted-for-7.0 Originally planned for the EF Core 7.0 (EF7) release, but moved out due to resource constraints. type-enhancement
Projects
None yet
Development

No branches or pull requests

4 participants