sqlmodel icon indicating copy to clipboard operation
sqlmodel copied to clipboard

✨ Add field-level db comments when a field description exists

Open iloveitaly opened this issue 11 months ago • 4 comments

This PR fixes https://github.com/fastapi/sqlmodel/issues/492#issuecomment-2489858633 by adding column-level db comments when a field description exists.

I can add some tests if this is the sort of PR that would be accepted.

I've implemented this in my SQLModel extension here: https://github.com/iloveitaly/activemodel/blob/master/activemodel/get_column_from_field_patch.py

Details:

  • feat: pull field descriptions into db comments
  • docs: document autostring
  • feat: add use_attribute_docstrings pydantic config for improved docstrings

iloveitaly avatar Feb 08 '25 23:02 iloveitaly

@svlandeg awesome, will work on CI and we can go from there! Is there anything else that I should work on in order to get this merged?

iloveitaly avatar Feb 25 '25 20:02 iloveitaly

@svlandeg awesome, will work on CI and we can go from there! Is there anything else that I should work on in order to get this merged?

A test case is always useful, as it helps the reviewer as well to quickly run a small example. And it'll likely be necessary anyway to get the test coverage back to 100% (ensuring that all code in the code base gets tested).

svlandeg avatar Feb 26 '25 07:02 svlandeg

Awesome, I should have some time to help there. I have a bunch of other SQLModel improvements I'd love to pull over from activemodel, so understanding the best contribution flow would be really helpful

iloveitaly avatar Feb 26 '25 14:02 iloveitaly

Awesome, I should have some time to help there. I have a bunch of other SQLModel improvements I'd love to pull over from activemodel, so understanding the best contribution flow would be really helpful

Sure thing, let me know if you have specific questions/doubts about contributing to sqlmodel, happy to provide guidance if needed!

svlandeg avatar Feb 28 '25 10:02 svlandeg