marshmallow-sqlalchemy icon indicating copy to clipboard operation
marshmallow-sqlalchemy copied to clipboard

Document Related Field

Open GabrielC101 opened this issue 5 years ago • 5 comments

Marshmallow-sqlalchemy contains a Field ~~"Result"~~ Related but the documentation doesn't reference it at all. Document Related field, and give examples of it's use.

GabrielC101 avatar Dec 14 '18 22:12 GabrielC101

I'm not sure what you're referring to. There's no Result class in the code.

sloria avatar Dec 16 '18 04:12 sloria

I am so sorry . . . I meant Related. I’ve edited the issue title.

GabrielC101 avatar Dec 16 '18 04:12 GabrielC101

Ah, I see. Yes, we should document that class. It's use for foreign key relationships.

I would definitely review/merge a PR adding docs.

sloria avatar Dec 16 '18 05:12 sloria

Thanks.

Specifically, it's not clear which args and kwargs Related uses, how it's related to Nested, how/if it handles secondary joins, how/if it handles multiple foreign keys, etc.

Currently, it translates all the relationships to the relevant UUID pks (I'm using Postgres). I don't know if this is a problem with Related or Postgres support. It might be a new bug, old bug, or I'm just not using it right. Hard to tell.

So far the best documentation is in the unit tests: https://github.com/marshmallow-code/marshmallow-sqlalchemy/blob/dev/tests/test_marshmallow_sqlalchemy.py

GabrielC101 avatar Dec 18 '18 17:12 GabrielC101

I added Related to the autogenerated documentation: https://marshmallow-sqlalchemy.readthedocs.io/en/latest/api_reference.html#marshmallow_sqlalchemy.fields.Related . The docs still need to be fleshed out, but it's a start.

Still accepting PRs!

sloria avatar Sep 05 '19 03:09 sloria