Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shangyian committed Dec 12, 2023
1 parent 42dae82 commit 2741dee
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
5 changes: 4 additions & 1 deletion datajunction-clients/python/datajunction/_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def request(self, method, url, *args, **kwargs):
if not exc.response:
error_message = str(exc)
print(error_message)
if exc.response and exc.response.headers.get("Content-Type") == "application/json":
if (
exc.response
and exc.response.headers.get("Content-Type") == "application/json"
):
error_message = exc.response.json().get("message")
if not error_message:
error_message = (
Expand Down
2 changes: 1 addition & 1 deletion datajunction-clients/python/datajunction/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ def load_node_configs_notebook_safe(repository: Path, priority: List[str]):
async def load_node_configs(
repository: Path,
priority: List[str],
) -> List[NodeYAML]:
) -> List[Optional[NodeConfig]]:
"""
Load all configs from a repository.
"""
Expand Down
12 changes: 11 additions & 1 deletion datajunction-server/tests/api/namespaces_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,6 +607,7 @@ def test_export_namespaces(client_with_examples: TestClient):
"/nodes/cube/",
json={
"name": "default.example_cube",
"display_name": "Example Cube",
"description": "An example cube so that the export path is tested",
"metrics": ["default.num_repair_orders"],
"dimensions": ["default.hard_hat.city"],
Expand All @@ -618,7 +619,16 @@ def test_export_namespaces(client_with_examples: TestClient):
"/namespaces/default/export/",
)
project_definition = response.json()
assert {d["filename"] for d in project_definition} == {
node_defs = {d["filename"]: d for d in project_definition}
assert node_defs["example_cube.cube.yaml"] == {
"description": "An example cube so that the export path is tested",
"dimensions": ["default.hard_hat.city"],
"directory": "",
"display_name": "Example Cube",
"filename": "example_cube.cube.yaml",
"metrics": ["default.num_repair_orders"],
}
assert set(node_defs.keys()) == {
"repair_orders.source.yaml",
"repair_order_details.source.yaml",
"repair_type.source.yaml",
Expand Down

0 comments on commit 2741dee

Please sign in to comment.