-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update database method names #1829
base: master
Are you sure you want to change the base?
Conversation
Note that |
We can also review the |
Did a search for an example "iter_citation" Did a search for an the related comment "Return an iterator over objects for" |
This is what I would suggest: iter_person_data = _iter_raw_person_data
iter_family_data = _iter_raw_family_data
iter_event_data = _iter_raw_event_data
iter_place_data = _iter_raw_place_data
iter_repository_data = _iter_raw_repository_data
iter_source_data = _iter_raw_source_data
iter_citation_data = _iter_raw_citation_data
iter_media_data = _iter_raw_media_data
iter_note_data = _iter_raw_note_data
iter_tag_data = _iter_raw_tag_data |
Is it likely that there will ever be a variant that interates through a person, the families where that person is a child or spouse AND the persons of those families? (So, their parents, siblings, themself, spouse, children and the Family objects too.) That superset of a person is where the action is most of the time. |
No, for technical reasons. All of the iterators just step over each table in the database. |
The improvements in name consistency seems good to me.
Could we go further?
|
@stevenyoungs, yes that would be the plan if approved. |
I'd also like to add the following methods (feel free to suggest better names):
These will be simple loops over the singular versions in the generic db class, but can be performed in SQL to a great speed advantage. We could also add the |
I'm assuming that these methods will return an array of Json data (DataDict) of all records of the relevant type in the db?
This maintains a clear link to the method returning a single record |
Yes, I like that better! |
BTW, if the basic foundation of the work-in-progress #1828 is accepted then we don't need the
|
This comment might be better on #1828 but... if all people records were wanted, it would be inefficient to prepare a suitable WHERE clause with thousands of handles. See https://github.com/gramps-project/gramps/pull/1828/files#r1897940380 |
Most of these suggestions seem reasonable to me. We should post about this on the gramps-devel mailing list so that all developers are aware of the proposal. I'd welcome more feedback on this one. The iterators need a little more thought. For each group of methods, we could also consider adding a method that takes an object type. For example, |
I would say no. If we use singular forms throughout (use "person" rather than "people") then that standardizes the names, and makes So, let's leave
|
I updated the description with the recommendations. I left out the ones that could have SQL backing as those would be obsolete if #1828 is approved. Next, I'll post on the gramps-devel mailing list as suggested. |
Now that the
raw
data is actually useful, and the data is hardly "raw", it would make sense to update the method names for all of the get_object methods to make them more consistent.This PR allows aliases for the common getters and iters. If this idea is accepted, I would also update the code base, and provide deprecation messages on the older forms.
Suggestions:
First, some of the methods (
get_raw_person_data
) have an impliedfrom_handle
. We can remove allfrom_handle
from most method names for consistency and usability:NOTE: new names on left, current names on right
Then, we don't need both
raw
anddata
, and is nicely parallel with the above:We only have one id, so we don't need to explicitly say that it is
gramps
:These methods are inexplicably private, and using the above rules, suggest:
Updated with iter-method suggested changes:
Changes from plural to singular:
And these would stay the same: