Updating from Oracle - #69
Merged
Merged
Conversation
Collaborator
|
Hi William, I just merged this PR: It should help fix some of the tests that are failing here. Could you pull from main and make sure the tests pass? Thank you! |
Merge remote-tracking branch 'origin/main' into update_db
eloise-nebula
approved these changes
Aug 18, 2026
eloise-nebula
left a comment
Collaborator
There was a problem hiding this comment.
Looks good! Thank you William!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix oracle_db() and clean up lcls_elements.csv includes added/updated data for LCLS-II-HE areas
Problems Fixed
1. KeyError: 'area' in oracle.py
_Inserter._rows()used mixed-case schema column names (e.g. "Area") as keyson the row dict, but
_parse_csv()lowercases all CSV headers, producing keyslike "area". This caused a KeyError on every call to
oracle_db().2. Wrong header row read in lcls_elements.py
The CSV has a group header on row 1 (e.g. "EPICS Channel Access Device", etc.)
and the actual column names on row 2.
_parse_csv()was consuming row 1 ascolumn names, misaligning all field mappings and producing broken row dicts.
Interim fixes (3, 4) to lcls_elements.csv: SLACPROD maintainer has been contacted and changes will be made permanent there. Fixing here in the mean time:
3. Duplicate BX31T entry in lcls_elements.csv
Element "BX31T" appeared twice in the CSV with identical fields except for the
Barcode column (4580T vs BX31T). This caused a UNIQUE constraint failure on
insert into lcls_elements.sqlite3. The duplicate row (Barcode = BX31T) has
been removed. The upstream CSV source will be fixed separately.
4. Missing Control System Names for L0A, L0B, L1X
The active entries for L0A, L0B, and L1X had empty Control System Name fields.
The correct values were present on their inactive counterparts (L0A___, L0B___,
L1X___) and have been copied over.
Changes
slac_db/oracle.py
Schema column names are mixed-case; parser row dicts use lowercase keys.
slac_db/create/lcls_elements.py
group header row (row 1) and use the actual column names on row 2.
slac_db/package_data/lcls_elements.csv
Testing
Verified with:
slac_db.create.oracle_db() # completes without error