Skip to content

Commit adf2d36

Browse files
fixed bug where variable length data wouldn't load correctly (#424)
1 parent 7784645 commit adf2d36

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

METdbLoad/ush/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@
727727

728728
if line_type in VAR_LINE_TYPES_TCST:
729729
LINE_DATA_COLS_TCST[line_type] = [LINE_DATA_ID] + LINE_DATA_COLS_TCST[line_type]
730+
LINE_DATA_FIELDS[line_type] = [LINE_DATA_ID] + LINE_DATA_FIELDS[line_type]
730731

731732
# For each line type, create insert queries
732733
VALUE_SLOTS = '%s, ' * len(LINE_DATA_FIELDS[line_type])
@@ -773,6 +774,7 @@
773774

774775
if line_type in VAR_LINE_TYPES:
775776
LINE_DATA_COLS[line_type] = [LINE_DATA_ID] + LINE_DATA_COLS[line_type]
777+
LINE_DATA_FIELDS[line_type] = [LINE_DATA_ID] + LINE_DATA_FIELDS[line_type]
776778

777779
# For each line type, create insert queries
778780
VALUE_SLOTS = '%s, ' * len(LINE_DATA_FIELDS[line_type])

METdbLoad/ush/run_sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def write_to_sql(raw_data, col_list, sql_table, sql_query, tmp_dir, sql_cur, loc
184184
str)
185185
raw_data['fcst_init'] = raw_data['fcst_init'].astype(
186186
str)
187-
else:
187+
elif 'fcst_valid_beg' in raw_data:
188188
raw_data['fcst_valid_beg'] = raw_data[
189189
'fcst_valid_beg'].astype(str)
190190
raw_data['fcst_valid_end'] = raw_data[

0 commit comments

Comments
 (0)