Skip to content

Conversation

@ikcom
Copy link

@ikcom ikcom commented Dec 7, 2024

This introduces the ignore_others parameter in pgtrigger.Trigger.
See discussion #190

@wesleykendall
Copy link
Member

Hey just wanted to give a heads up that I have this on my radar to review and get in this weekend. At first glance, this looks amazing though! Thank you so much - this has definitely been on my wishlist for pgtrigger

),
} | self.kwargs

return self.func.format(**kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

Func doesn't seem to be the optimal place for generating boilerplate wrapper SQL like this. For example, this is where triggers are wrapped with the ability to be ignored. I assumed that we would also generate this boilerplate in a similar way. Having a self.kwargs variable also strikes me as a hack.

Was there a reason behind overriding Func?

Copy link
Author

@ikcom ikcom Dec 15, 2024

Choose a reason for hiding this comment

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

Only that Func seemed to be only a wrapper for string formatting. This extends it to also provide custom context. See docs/ignoring_triggers.md:101

The reset_ignore template can very well be defined outside the Func

Copy link
Author

Choose a reason for hiding this comment

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

About your example in compiler.py. I could not think of a way to wrap a user defined trigger body in such a way that resetting the _pgtrigger_ignore would always get executed. The user might return from any branch in their script.
The user would have to decide when to reset it

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.

2 participants