Skip to content

Commit

Permalink
catch empty name and tables
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-cnivera committed Oct 16, 2024
1 parent b097a89 commit e7cf8a8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app_utils/shared_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1223,9 +1223,9 @@ def run_generate_model_str_from_snowflake(
"""

if not model_name:
st.error("Please provide a name for your semantic model.")
raise ValueError("Please provide a name for your semantic model.")
elif not base_tables:
st.error("Please select at least one table to proceed.")
raise ValueError("Please select at least one table to proceed.")
else:
with st.spinner("Generating model. This may take a minute or two..."):
yaml_str = generate_model_str_from_snowflake(
Expand Down
19 changes: 11 additions & 8 deletions journeys/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,17 @@ def table_selector_dialog() -> None:

submit = st.button("Submit", use_container_width=True, type="primary")
if submit:
run_generate_model_str_from_snowflake(
model_name,
sample_values,
st.session_state["selected_tables"],
allow_joins=experimental_features,
)
st.session_state["page"] = GeneratorAppScreen.ITERATION
st.rerun()
try:
run_generate_model_str_from_snowflake(
model_name,
sample_values,
st.session_state["selected_tables"],
allow_joins=experimental_features,
)
st.session_state["page"] = GeneratorAppScreen.ITERATION
st.rerun()
except ValueError as e:
st.error(e)


def show() -> None:
Expand Down
16 changes: 10 additions & 6 deletions partner/looker.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,16 @@ def set_looker_semantic() -> None:
if st.session_state[
"looker_field_metadata"
]: # Create view only if full rendering is successful
run_generate_model_str_from_snowflake(
model_name,
sample_values,
[full_tablename],
allow_joins=experimental_features,
)
try:
run_generate_model_str_from_snowflake(
model_name,
sample_values,
[full_tablename],
allow_joins=experimental_features,
)
except ValueError as e:
st.error(e)
st.stop()
st.session_state["partner_setup"] = True

# Tag looker setup with SIT query tag
Expand Down

0 comments on commit e7cf8a8

Please sign in to comment.