astrodbtoolkit / astrodbtoolkit/AstrodbKit
Nulls and load_table
- Dominant language
- Python
- Stars
- 12
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
Feedback from https://github.com/wvining/MIRION_Database_v4/blob/main/workflow.md. I don't really understand this and am not sure if it needs fixing but FYI:
> Discovered and worked around an astrodbkit quirk: load_table calls .insert().values(data) unconditionally — for data == [] (an empty-array reference JSON file), SQLAlchemy's insert().values([]) inserts one all-default row rather than zero rows, which fails NOT NULL constraints. Fix: don't leave empty-array placeholder files for Publications/AssociationList/ParameterList/SourceTypeList — load_table only loads a lookup table if its JSON file exists at all, so deleting the file (rather than emptying it to []) skips the load cleanly. These will be (re)created for real once Phases 6-7 populate them.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading workflow.md and locating the load_table entry point; compare behavior when referenced JSON files are absent versus empty arrays. Confirm whether empty-array lookup files should be skipped without inserting rows, and identify the expected test or documentation update. The payload names no implementation file or test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlalchemy
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100