Skip to content

Commit 1020ac5

Browse files
committed
manually initialized course mappings
1 parent 4fdd655 commit 1020ac5

File tree

1 file changed

+9
-32
lines changed

1 file changed

+9
-32
lines changed

src/webapp/databricks.py

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -655,38 +655,15 @@ def create_custom_schema_extension(
655655
LOGGER.exception("WorkspaceClient init failed")
656656
raise ValueError(f"Workspace client initialization failed: {e}")
657657

658-
# 2) Fetch & parse config.toml to get validation_mapping
659-
try:
660-
inst_name = inst_query.name
661-
inst_id = str(inst_query.id)
662-
config_volume_path = (
663-
f"/Volumes/{catalog_name}/"
664-
f"{databricksify_inst_name(inst_name)}_bronze/bronze_volume/config.toml"
665-
)
666-
LOGGER.info("Attempting to download from %s", config_volume_path)
667-
response = w.files.download(config_volume_path)
668-
stream = cast(IO[bytes], response.contents)
669-
file_bytes = stream.read()
670-
LOGGER.info("Download successful, received %d bytes", len(file_bytes))
671-
except Exception as e:
672-
LOGGER.exception("Failed to fetch config.toml")
673-
raise HTTPException(500, detail=f"Failed to fetch config: {e}")
674-
675-
try:
676-
cfg = _toml.loads(file_bytes.decode("utf-8"))
677-
mapping = cfg["webapp"]["validation_mapping"]
678-
except KeyError:
679-
raise HTTPException(
680-
404, detail="Missing [webapp].validation_mapping in config.toml"
681-
)
682-
except Exception as e:
683-
LOGGER.exception("Invalid TOML")
684-
raise HTTPException(400, detail=f"Invalid TOML in {file_name}: {e}")
685-
686-
if not isinstance(mapping, dict):
687-
raise HTTPException(
688-
400, detail="validation_mapping must be a TOML table (dictionary)"
689-
)
658+
inst_name = inst_query.name
659+
inst_id = str(inst_query.id)
660+
661+
662+
mapping = {
663+
"student": "student.csv",
664+
"course": ["course.csv", "courses.csv"],
665+
"semester": ["semester"]
666+
}
690667

691668
key = self.get_key_for_file(mapping, file_name) # e.g., "student"
692669
if key is None:

0 commit comments

Comments
 (0)