Skip to content

feat(db): make trait_names optional in get_trait_data_pft()#4026

Open
omkarrr2533 wants to merge 1 commit into
PecanProject:developfrom
omkarrr2533:gsoc/trait-names-optional
Open

feat(db): make trait_names optional in get_trait_data_pft()#4026
omkarrr2533 wants to merge 1 commit into
PecanProject:developfrom
omkarrr2533:gsoc/trait-names-optional

Conversation

@omkarrr2533
Copy link
Copy Markdown
Member

Makes trait_names optional in get_trait_data_pft(), defaulting to NULL. When it's NULL the function returns priors for every trait associated with the PFT and derives the trait list from those, so you don't have to know the trait names up front just to get "all priors for this PFT". Passing a trait_names vector behaves exactly as before.

This is the follow-up @mdietze split out of the #3978 review. Closes #3985.

query.priors already supports this: trstr defaults to NULL and the AND variables.name IN (...) clause is only added when trstr is non-NULL, so the standalone just passes NULL through and gets all priors back. No change needed there.

Added a test for the NULL path (the unfiltered call has to be a superset of a single-trait filter), and removed a duplicated zero-rows test that was sitting at the end of the file. Ran the get_trait_data_pft tests locally against pecan/db:ci and the new plus the existing standalone tests pass.

@omkarrr2533 omkarrr2533 marked this pull request as ready for review June 6, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make trait_names optional in get_trait_data_pft()

2 participants