Skip to content

Commit dbadfe8

Browse files
authored
Merge pull request #2064 from Chessing234/fix/sqlite-import-sh-basename
sqlite import.sh: basename before table name stem
2 parents f0e52a0 + cec50c0 commit dbadfe8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

mimic-iv/buildmimic/sqlite/import.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ fi
2424
for FILE in */**.csv*; do
2525
# skip loop if glob didn't match an actual file
2626
[ -f "$FILE" ] || continue
27-
# trim off extension and lowercase file stem (e.g., HELLO.csv -> hello)
28-
TABLE_NAME=$(echo "${FILE%%.*}" | tr "[:upper:]" "[:lower:]")
27+
# basename then stem: hosp/ADMISSIONS.csv.gz -> admissions (not hosp/admissions)
28+
BASENAME=$(basename "$FILE")
29+
TABLE_NAME=$(echo "${BASENAME%%.*}" | tr "[:upper:]" "[:lower:]")
2930
case "$FILE" in
3031
*csv)
3132
IMPORT_CMD=".import $FILE $TABLE_NAME"

0 commit comments

Comments
 (0)