Please help <@U08V4MVT2QM> with this error - {"inf...
# ask-elementary-ai
n
Please help @Wale Olaitan with this error - {"info": {"name": "RunningOperationCaughtError", "code": "Q001", "msg": "Encountered an error while running operation: Database Error\n Database Error\n \n [TEMP_VIEW_NAME_TOO_MANY_NAME_PARTS] CREATE TEMPORARY VIEW or the corresponding Dataset APIs only accept single-part view names, but got:
ocs_dev
.
elementary
.
ordered_test_results__tmp_20250603142630102253
k
A message from kapa.ai
The error you're encountering:
Copy code
[TEMP_VIEW_NAME_TOO_MANY_NAME_PARTS] CREATE TEMPORARY VIEW or the corresponding Dataset APIs only accept single-part view names, but got: `ocs_dev`.`elementary`.`ordered_test_results__tmp_20250603142630102253`
is a known issue when using Spark or Databricks. Spark does not allow creating temporary views with a schema (or database) prefix; it only accepts single-part names for temporary views. In your case, the code is trying to create a temporary view with a fully qualified name (
ocs_dev
.
elementary
.
...
), which Spark does not support. Solution: A workaround discussed in the Elementary community is to override the macro responsible for creating temporary views so that it does not include the schema/database prefix. Specifically, you can override the
spark__make_temp_relation
macro to ensure the schema is set to
none
when creating temp views. Here’s an example of how this can be done:
Copy code
jinja {% macro spark__make_temp_relation(base_relation, suffix) %}     {% set tmp_identifier = base_relation.identifier ~ suffix %}     {% set tmp_relation = base_relation.incorporate(path = {         "schema": none,         "identifier": tmp_identifier     }) -%}      {% do return(tmp_relation) %} {% endmacro %}
This approach was discussed and a fix was proposed in the Elementary GitHub repository. The Elementary team also mentioned that they would prefer to override the macro in their package rather than in dbt itself, to avoid interfering with other packages. You can follow the progress and see the fix here: [GitHub PR for Spark temp view fix](https://github.com/elementary-data/dbt-data-reliability/pull/452) and the related [issue](https://github.com/elementary-data/elementary/issues/1048) [source](https://slack.com/archives/C02CTC89LAX/p1690360303394909). Next steps: - Upgrade to the latest version of the Elementary dbt package, as this issue has been addressed in recent releases. - If you are still experiencing the issue after upgrading, consider overriding the macro as shown above in your own project until the fix is available in the version you are using. Let me know if you need more detailed guidance on how to implement this override!