Closed dsjoho closed 7 months ago
@dsjoho , I am going to take your suggestion and replace dbo with generate_schema_name
macro.
Can you share the steps to invoke fabric__get_test_sql
from dbt project? I will run some tests and support something close to this post - https://stackoverflow.com/questions/73563223/dbt-conditionally-set-schema-config
In the macro
fabric__get_test_sql
in macros/materializations/tests/helpers.sql, the schema for the temporary testview is hardcoded asdbo.testview_{{ range(1300, 19000) | random}}
. See https://github.com/microsoft/dbt-fabric/blob/a97aa2fa94cc940fa925162cbd1a976ad776dfb4/dbt/include/fabric/macros/materializations/tests/helpers.sql#L4-L6This breaks in the situation where dbt does not have access to the dbo schema, or the preferred schema is something else.
I suggest that this should instead utilize the generate_schema_name macro with a custom schema name. Possibly with a custom_name to allow redirecting it, or just letting it fall through to place the testview in the default schema.
Maybe something like
Or the sensible way of not providing any custom schema name in which case we just get whatever the target profile uses.