X-Raying a model from metabase analytics generates a buggy card #41944
Open
Description
Describe the bug
Just tried to x-ray a model from metabase analytics and got a card with an error
clicking on the card you'll see
To Reproduce
- start Metabase enterprise
- go to Metabase analytics
- x-ray any table
Expected behavior
It should not generate cards with errors
Logs
2024-04-29 10:16:43,879 ERROR middleware.catch-exceptions :: Error processing query: Failed to fetch :metadata/column 1559
{:database_id 13371337,
:started_at #t "2024-04-29T10:16:43.843836Z[GMT]",
:via
[{:status :failed,
:class clojure.lang.ExceptionInfo,
:error "Error resolving Fields in query: Failed to fetch :metadata/column 1559",
:stacktrace
["--> query_processor.middleware.resolve_fields$resolve_fields.invokeStatic(resolve_fields.clj:32)"
"query_processor.middleware.resolve_fields$resolve_fields.invoke(resolve_fields.clj:22)"
"query_processor.middleware.upgrade_field_literals$upgrade_field_literals.invokeStatic(upgrade_field_literals.clj:109)"
"query_processor.middleware.upgrade_field_literals$upgrade_field_literals.invoke(upgrade_field_literals.clj:91)"
"query_processor$preprocess_STAR_$fn__73403.invoke(query_processor.clj:164)"
"query_processor$preprocess_STAR_.invokeStatic(query_processor.clj:162)"
"query_processor$preprocess_STAR_.invoke(query_processor.clj:157)"
"query_processor$fn__73411$combined_pre_process__73412$combined_pre_process_STAR___73413.invoke(query_processor.clj:259)"
"query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__66697.invoke(fetch_source_query.clj:299)"
"query_processor.middleware.resolve_database_and_driver$resolve_driver_and_database_local_values$fn__72154$fn__72158.invoke(resolve_database_and_driver.clj:77)"
"driver$do_with_driver.invokeStatic(driver.clj:97)"
"driver$do_with_driver.invoke(driver.clj:92)"
"query_processor.middleware.resolve_database_and_driver$resolve_driver_and_database_local_values$fn__72154.invoke(resolve_database_and_driver.clj:76)"
"query_processor.middleware.store$initialize_store$fn__67324$fn__67325.invoke(store.clj:14)"
"query_processor.store$do_with_metadata_provider.invokeStatic(store.clj:169)"
"query_processor.store$do_with_metadata_provider.invoke(store.clj:150)"
"query_processor.store$do_with_metadata_provider.invokeStatic(store.clj:158)"
"query_processor.store$do_with_metadata_provider.invoke(store.clj:150)"
"query_processor.middleware.store$initialize_store$fn__67324.invoke(store.clj:13)"
"query_processor.middleware.resolve_database_and_driver$resolve_database$fn__72151.invoke(resolve_database_and_driver.clj:60)"
"query_processor.middleware.normalize_query$normalize$fn__72456.invoke(normalize_query.clj:38)"
"metabase_enterprise.audit_app.query_processor.middleware.handle_audit_queries$fn__79812$handle_audit_app_internal_queries__79813$fn__79815.invoke(handle_audit_queries.clj:142)"
"query_processor.middleware.enterprise$handle_audit_app_internal_queries_middleware$fn__72102.invoke(enterprise.clj:103)"
"query_processor.middleware.constraints$mark_needs_default_userland_constraints$fn__71217.invoke(constraints.clj:104)"
"query_processor.middleware.process_userland_query$process_userland_query$fn__72387.invoke(process_userland_query.clj:156)"
"query_processor.middleware.catch_exceptions$catch_exceptions$fn__72988.invoke(catch_exceptions.clj:171)"
"query_processor.reducible$async_qp$qp_STAR___62838$thunk__62840.invoke(reducible.clj:126)"
"query_processor.reducible$async_qp$qp_STAR___62838.invoke(reducible.clj:132)"
"query_processor.reducible$sync_qp$qp_STAR___62850.doInvoke(reducible.clj:153)"
"query_processor$process_userland_query.invokeStatic(query_processor.clj:402)"
"query_processor$process_userland_query.doInvoke(query_processor.clj:398)"
"query_processor$process_query_and_save_execution_BANG_.invokeStatic(query_processor.clj:416)"
"query_processor$process_query_and_save_execution_BANG_.invoke(query_processor.clj:406)"
"query_processor$process_query_and_save_with_max_results_constraints_BANG_.invokeStatic(query_processor.clj:431)"
"query_processor$process_query_and_save_with_max_results_constraints_BANG_.invoke(query_processor.clj:421)"
"api.dataset$run_query_async$fn__94633.invoke(dataset.clj:79)"
"query_processor.streaming$streaming_response_STAR_$fn__53268$fn__53270.invoke(streaming.clj:168)"
"query_processor.streaming$streaming_response_STAR_$fn__53268.invoke(streaming.clj:167)"
"async.streaming_response$do_f_STAR_.invokeStatic(streaming_response.clj:69)"
"async.streaming_response$do_f_STAR_.invoke(streaming_response.clj:67)"
"async.streaming_response$do_f_async$task__43763.invoke(streaming_response.clj:88)"],
:error_type :qp,
:ex-data
{:field-ids #{210 213 1559 208 214 216 198 215 211 207 209 212},
:query
{:database 13371337,
:query
{:aggregation [[:distinct [:field 1559 {:source-field 215}]]],
:source-card-id 28,
:source-query {:source-table 21},
:source-metadata
[{:description nil,
:semantic_type :type/PK,
:coercion_strategy nil,
:name "entity_id",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 198 nil],
:effective_type :type/Integer,
:id 198,
:visibility_type :normal,
:display_name "Entity ID",
:base_type :type/Integer}
{:description nil,
:semantic_type :type/PK,
:coercion_strategy nil,
:name "entity_qualified_id",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 216 nil],
:effective_type :type/Text,
:id 216,
:visibility_type :normal,
:display_name "Entity Qualified ID",
:base_type :type/Text}
{:description nil,
:semantic_type :type/CreationTimestamp,
:coercion_strategy nil,
:unit :default,
:name "created_at",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 211 {:temporal-unit :default}],
:effective_type :type/DateTimeWithLocalTZ,
:id 211,
:visibility_type :normal,
:display_name "Created At",
:base_type :type/DateTimeWithLocalTZ}
{:description nil,
:semantic_type :type/UpdatedTimestamp,
:coercion_strategy nil,
:unit :default,
:name "updated_at",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 210 {:temporal-unit :default}],
:effective_type :type/DateTimeWithLocalTZ,
:id 210,
:visibility_type :normal,
:display_name "Updated At",
:base_type :type/DateTimeWithLocalTZ}
{:description nil,
:semantic_type :type/Name,
:coercion_strategy nil,
:name "name",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 208 nil],
:effective_type :type/Text,
:id 208,
:visibility_type :normal,
:display_name "Name",
:base_type :type/Text}
{:description nil,
:semantic_type :type/Name,
:coercion_strategy nil,
:name "display_name",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 209 nil],
:effective_type :type/Text,
:id 209,
:visibility_type :normal,
:display_name "Display Name",
:base_type :type/Text}
{:description nil,
:semantic_type :type/Description,
:coercion_strategy nil,
:name "description",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 207 nil],
:effective_type :type/Text,
:id 207,
:visibility_type :normal,
:display_name "Description",
:base_type :type/Text}
{:description "True if table is available in the data source. False if it not found in sync anymore.",
:semantic_type :type/Category,
:coercion_strategy nil,
:name "active",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 214 nil],
:effective_type :type/Boolean,
:id 214,
:visibility_type :normal,
:display_name "Active",
:base_type :type/Boolean}
{:description nil,
:semantic_type :type/FK,
:coercion_strategy nil,
:name "database_id",
:settings nil,
:fk_target_field_id 1559,
:field_ref [:field 215 nil],
:effective_type :type/Integer,
:id 215,
:visibility_type :normal,
:display_name "Database ID",
:base_type :type/Integer}
{:description nil,
:semantic_type nil,
:coercion_strategy nil,
:name "schema",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 212 nil],
:effective_type :type/Text,
:id 212,
:visibility_type :normal,
:display_name "Schema",
:base_type :type/Text}
{:description nil,
:semantic_type :type/Category,
:coercion_strategy nil,
:name "is_upload",
:settings nil,
:fk_target_field_id nil,
:field_ref [:field 213 nil],
:effective_type :type/Boolean,
:id 213,
:visibility_type :normal,
:display_name "Is Upload",
:base_type :type/Boolean}],
:source-query/dataset? true},
:type :query,
:middleware
{:js-int-to-string? true,
:add-default-userland-constraints? true,
:metabase.query-processor.middleware.constraints/add-userland-constraints? true},
:info
{:executed-by 1,
:context :ad-hoc,
:card-id 28,
:metadata/dataset-metadata
[{:semantic_type :type/PK,
:name "entity_id",
:field_ref [:field 198 nil],
:effective_type :type/Integer,
:id 198,
:visibility_type :normal,
:display_name "Entity ID",
:base_type :type/Integer}
{:semantic_type :type/PK,
:name "entity_qualified_id",
:field_ref [:field 216 nil],
:effective_type :type/Text,
:id 216,
:visibility_type :normal,
:display_name "Entity Qualified ID",
:base_type :type/Text}
{:semantic_type :type/CreationTimestamp,
:unit :default,
:name "created_at",
:field_ref [:field 211 {:temporal-unit :default}],
:effective_type :type/DateTimeWithLocalTZ,
:id 211,
:visibility_type :normal,
:display_name "Created At",
:base_type :type/DateTimeWithLocalTZ}
{:semantic_type :type/UpdatedTimestamp,
:unit :default,
:name "updated_at",
:field_ref [:field 210 {:temporal-unit :default}],
:effective_type :type/DateTimeWithLocalTZ,
:id 210,
:visibility_type :normal,
:display_name "Updated At",
:base_type :type/DateTimeWithLocalTZ}
{:semantic_type :type/Name,
:name "name",
:field_ref [:field 208 nil],
:effective_type :type/Text,
:id 208,
:visibility_type :normal,
:display_name "Name",
:base_type :type/Text}
{:semantic_type :type/Name,
:name "display_name",
:field_ref [:field 209 nil],
:effective_type :type/Text,
:id 209,
:visibility_type :normal,
:display_name "Display Name",
:base_type :type/Text}
{:semantic_type :type/Description,
:name "description",
:field_ref [:field 207 nil],
:effective_type :type/Text,
:id 207,
:visibility_type :normal,
:display_name "Description",
:base_type :type/Text}
{:description "True if table is available in the data source. False if it not found in sync anymore.",
:semantic_type :type/Category,
:name "active",
:field_ref [:field 214 nil],
:effective_type :type/Boolean,
:id 214,
:visibility_type :normal,
:display_name "Active",
:base_type :type/Boolean}
{:semantic_type :type/FK,
:name "database_id",
:fk_target_field_id 1559,
:field_ref [:field 215 nil],
:effective_type :type/Integer,
:id 215,
:visibility_type :normal,
:display_name "Database ID",
:base_type :type/Integer}
{:name "schema",
:field_ref [:field 212 nil],
:effective_type :type/Text,
:id 212,
:visibility_type :normal,
:display_name "Schema",
:base_type :type/Text}
{:semantic_type :type/Category,
:name "is_upload",
:field_ref [:field 213 nil],
:effective_type :type/Boolean,
:id 213,
:visibility_type :normal,
:display_name "Is Upload",
:base_type :type/Boolean}],
:query-hash #object["[B" 0x1c46c1af "[B@1c46c1af"]}},
:type :qp}}],
:action_id nil,
:error_type :invalid-query,
:json_query
{:database 13371337,
:query {:aggregation [["distinct" ["field" 1559 {:source-field 215}]]], :source-table "card__28"},
:type "query",
:parameters [],
:middleware {:js-int-to-string? true, :add-default-userland-constraints? true}},
:native nil,
:status :failed,
:class clojure.lang.ExceptionInfo,
:stacktrace
["--> query_processor.store$missing_bulk_metadata_error.invokeStatic(store.clj:182)"
"query_processor.store$missing_bulk_metadata_error.invoke(store.clj:181)"
"query_processor.store$bulk_metadata$fn__50919.invoke(store.clj:221)"
"query_processor.store$bulk_metadata.invokeStatic(store.clj:219)"
"query_processor.store$bulk_metadata.invoke(store.clj:189)"
"query_processor.middleware.resolve_fields$resolve_fields_with_ids_BANG_.invokeStatic(resolve_fields.clj:13)"
"query_processor.middleware.resolve_fields$resolve_fields_with_ids_BANG_.invoke(resolve_fields.clj:11)"
"query_processor.middleware.resolve_fields$resolve_fields.invokeStatic(resolve_fields.clj:30)"
"query_processor.middleware.resolve_fields$resolve_fields.invoke(resolve_fields.clj:22)"
"query_processor.middleware.upgrade_field_literals$upgrade_field_literals.invokeStatic(upgrade_field_literals.clj:109)"
"query_processor.middleware.upgrade_field_literals$upgrade_field_literals.invoke(upgrade_field_literals.clj:91)"
"query_processor$preprocess_STAR_$fn__73403.invoke(query_processor.clj:164)"
"query_processor$preprocess_STAR_.invokeStatic(query_processor.clj:162)"
"query_processor$preprocess_STAR_.invoke(query_processor.clj:157)"
"query_processor$fn__73411$combined_pre_process__73412$combined_pre_process_STAR___73413.invoke(query_processor.clj:259)"
"query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__66697.invoke(fetch_source_query.clj:299)"
"query_processor.middleware.resolve_database_and_driver$resolve_driver_and_database_local_values$fn__72154$fn__72158.invoke(resolve_database_and_driver.clj:77)"
"driver$do_with_driver.invokeStatic(driver.clj:97)"
"driver$do_with_driver.invoke(driver.clj:92)"
"query_processor.middleware.resolve_database_and_driver$resolve_driver_and_database_local_values$fn__72154.invoke(resolve_database_and_driver.clj:76)"
"query_processor.middleware.store$initialize_store$fn__67324$fn__67325.invoke(store.clj:14)"
"query_processor.store$do_with_metadata_provider.invokeStatic(store.clj:169)"
"query_processor.store$do_with_metadata_provider.invoke(store.clj:150)"
"query_processor.store$do_with_metadata_provider.invokeStatic(store.clj:158)"
"query_processor.store$do_with_metadata_provider.invoke(store.clj:150)"
"query_processor.middleware.store$initialize_store$fn__67324.invoke(store.clj:13)"
"query_processor.middleware.resolve_database_and_driver$resolve_database$fn__72151.invoke(resolve_database_and_driver.clj:60)"
"query_processor.middleware.normalize_query$normalize$fn__72456.invoke(normalize_query.clj:38)"
"metabase_enterprise.audit_app.query_processor.middleware.handle_audit_queries$fn__79812$handle_audit_app_internal_queries__79813$fn__79815.invoke(handle_audit_queries.clj:142)"
"query_processor.middleware.enterprise$handle_audit_app_internal_queries_middleware$fn__72102.invoke(enterprise.clj:103)"
"query_processor.middleware.constraints$mark_needs_default_userland_constraints$fn__71217.invoke(constraints.clj:104)"
"query_processor.middleware.process_userland_query$process_userland_query$fn__72387.invoke(process_userland_query.clj:156)"
"query_processor.middleware.catch_exceptions$catch_exceptions$fn__72988.invoke(catch_exceptions.clj:171)"
"query_processor.reducible$async_qp$qp_STAR___62838$thunk__62840.invoke(reducible.clj:126)"
"query_processor.reducible$async_qp$qp_STAR___62838.invoke(reducible.clj:132)"
"query_processor.reducible$sync_qp$qp_STAR___62850.doInvoke(reducible.clj:153)"
"query_processor$process_userland_query.invokeStatic(query_processor.clj:402)"
"query_processor$process_userland_query.doInvoke(query_processor.clj:398)"
"query_processor$process_query_and_save_execution_BANG_.invokeStatic(query_processor.clj:416)"
"query_processor$process_query_and_save_execution_BANG_.invoke(query_processor.clj:406)"
"query_processor$process_query_and_save_with_max_results_constraints_BANG_.invokeStatic(query_processor.clj:431)"
"query_processor$process_query_and_save_with_max_results_constraints_BANG_.invoke(query_processor.clj:421)"
"api.dataset$run_query_async$fn__94633.invoke(dataset.clj:79)"
"query_processor.streaming$streaming_response_STAR_$fn__53268$fn__53270.invoke(streaming.clj:168)"
"query_processor.streaming$streaming_response_STAR_$fn__53268.invoke(streaming.clj:167)"
"async.streaming_response$do_f_STAR_.invokeStatic(streaming_response.clj:69)"
"async.streaming_response$do_f_STAR_.invoke(streaming_response.clj:67)"
"async.streaming_response$do_f_async$task__43763.invoke(streaming_response.clj:88)"],
:card_id 28,
:context :ad-hoc,
:error "Failed to fetch :metadata/column 1559",
:row_count 0,
:running_time 0,
:preprocessed nil,
:ex-data
{:status-code 400,
:type :invalid-query,
:metadata-provider
(metabase.lib.metadata.cached-provider/cached-metadata-provider (metabase.lib.metadata.jvm/->UncachedApplicationDatabaseMetadataProvider 13371337)),
:metadata-type :metadata/column,
:id 1559},
:data {:rows [], :cols []}}
Information about your Metabase installation
v49.6 with a postgres db
Severity
p3
Additional context
NA