Closed zimtkeks closed 2 months ago
For sure, i'm interested in (at a minimum) any changeset that increases the overall coverage of the database object we already support!
What you have so far is pretty much most/all of what i think you'll need to do for the actual impl of the feature, modulo my PR comment.
As for tests, for most preexisting object types, it should be unnecessary to write any actual alembic test, so the easiest way to go about testing is generally just by copying any trigger existing test and just adapting to cover your usecase.
For this particular feature, i wouldn't think you'd need to worry about specific updating tests because any actual change to the arguments list will realistically require a replacement of the whole trigger. So i figure a trigger with a single argument, and a trigger with 2 arguments probably covers all the meaningful tests you could write.
As for documentation, i think just including a bit about how to use it in the docstring, as well as revising some of the notes in https://github.com/DanCardin/sqlalchemy-declarative-extensions/blob/main/docs/source/dialects/postgresql.md about how it only supports the audit feature is probably the sum total of what you'd need.
Finally, feel free to bump the minor version in the pyproject.toml, and include a note in the changelog. otherwise i'll do so after this gets merged anyway.
Thanks for your helpful reply!
I revised the parsing of trigger arguments from pg_trigger.tgargs
(and actually tested it this time..).
While the byte representation is an implementation detail and a bit weird, it doesn't look like it'll change anytime soon. And using tgargs
(instead of parsing the output of pg_get_triggerdef()
) better fits with existing code.
Next, I'll try to come up with test for single/mult-argument triggers.
BTW, is it possible for me to run the test.yml workflow on this PR, just for getting feedback if something is broken?
Thanks!
Happy to let your PR run CI, but generally i'd expect you to only really require it for bulk testing cross-python-version stuff, which your pr doesn't really deal with. If you're passing pytest tests/trigger
and make lint
locally, i suspect you'll have a good time generally.
Totals | |
---|---|
Change from base Build 10583611943: | 90.8% |
Covered Lines: | 3355 |
Relevant Lines: | 3648 |
As you suggested, I added a test in form of test_arguments.py
based on test_wrapped_parens.py
and made minor changes to project files and documentation. That's all I suppose was necessary.
Please let me know if you spot something I missed.
Hm, is there anything I can do to fix the failures? They seem unrelated to this PR..
unfortunately, i've noticed some relatively rare CI-only test randomness because of the network/port stuff going on to make these tests run in parallel.
Thank you for supporting and merging my first OSS contribution :)
I'm looking forward to the 0.14 release. Do you have an idea when that might be possible? Thanks!
Sorry about that, should be released now!
Thank you for supporting and merging my first OSS contribution :)
No problem at all, thanks for the contribution!
Hello,
first of all, I really appreciate this library and the work that went into it. It's a really useful addition when using an ORM and alembic.
There's one feature that is not supported, but relevant for my use-case, namely triggers that have arguments. Triggers without arguments are supported, though.
Being encouraged by your contribution guideline, I decided to implement changes, that extend
sqlalchemy_declarative_extensions.dialects.postgresql.trigger.Trigger
and related code such that it works for my use-case. With some good will the present state may be considered as a PoC.Given that there is interest on maintainer-side for adding this feature, I'd like to extend this PR such that it is worthy of being merged (including test cases, documentation, etc.).
I'd like to contribute, but I also need guidance to do so. I'm fairly new to SQLA, postgres DBs and even contributing to an OSS project. I'm not sure how to get some feedback. So for now I hope a draft PR is fine for collecting and discussing code changes.
Please let me know if you're interested in a collaboration (also if you're not). I'll try to keep the workload low on your end. I'll probably only need a few hints. Maybe you have some already :-) (e.g. implementation issue I overlooked, some test that could serve as base to test the feature)
Thank you very much!