You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Run fails with view_update_via_alter: true when view has table properties #1096
When using use_materialization_v2: true and view_update_via_alter: true for a model, the command dbt run fails, when the view has table properties set in the Unity Catalog.
This is problematic when maintaining comments on views via the UI or the SQL-Statement COMMENT ON, because these statements create the table property comment, which results in failing deployments.
Steps To Reproduce
Create model with config use_materialization_v2: true and view_update_via_alter: true as view
Run the model
Add a comment to the view in the UI or run COMMENT ON statement
Run the model
Expected behavior
The second run (step 4) does not fail and the model gets skipped
System information
The output of dbt --version:
Core:
- installed: 1.10.3
- latest: 1.10.3 - Up to date!
Plugins:
- databricks: 1.10.4 - Up to date!
- spark: 1.9.2 - Up to date!
@benc-db, the error message says "Runtime Error in model (<path_to_model>)
main is not being called during running model". I pasted the terminal prints. In between the 2 runs I created a comment in the UI on the view I created here.
(.venv) PS .\dbt> dbt run --select delete_me
12:43:52 Running with dbt=1.10.3
WARNING:thrift.transport.sslcompat:using legacy validation callback
.\dbt.venv\Lib\site-packages\pydantic_internal_config.py:373: UserWarning: Valid config keys have changed in V2:
'allow_population_by_field_name' has been renamed to 'validate_by_name'
warnings.warn(message, UserWarning)
12:44:00 Registered adapter: databricks=1.10.4
12:44:01 Found 13 models, 12 seeds, 3 data tests, 3 sources, 803 macros
12:44:01
12:44:01 Concurrency: 1 threads (target='dev')
12:44:01
12:44:06 1 of 1 START sql view model delete_me.delete_me ................................ [RUN]
12:44:07 1 of 1 OK created sql view model delete_me.delete_me ........................... [OK in 1.00s]
12:44:08
12:44:08 Finished running 1 view model in 0 hours 0 minutes and 6.60 seconds (6.60s).
12:44:08
12:44:08 Completed successfully
12:44:08
12:44:08 Done. PASS=1 WARN=0 ERROR=0 SKIP=0 NO-OP=0 TOTAL=1
--Added Comment in the UI
(.venv) PS .\dbt> dbt run --select delete_me
12:44:22 Running with dbt=1.10.3
WARNING:thrift.transport.sslcompat:using legacy validation callback
.\dbt.venv\Lib\site-packages\pydantic_internal_config.py:373: UserWarning: Valid config keys have changed in V2:
'allow_population_by_field_name' has been renamed to 'validate_by_name'
warnings.warn(message, UserWarning)
12:44:31 Registered adapter: databricks=1.10.4
12:44:32 Found 13 models, 12 seeds, 3 data tests, 3 sources, 803 macros
12:44:32
12:44:32 Concurrency: 1 threads (target='dev')
12:44:32
12:44:36 1 of 1 START sql view model delete_me.delete_me ................................ [RUN]
12:44:38 1 of 1 ERROR creating sql view model delete_me.delete_me ....................... [ERROR in 2.42s]
12:44:39
12:44:39 Finished running 1 view model in 0 hours 0 minutes and 7.21 seconds (7.21s).
12:44:39
12:44:39 Completed with 1 error, 0 partial successes, and 0 warnings:
12:44:39
12:44:39 Failure in model delete_me (models\delete_me\delete_me.sql)
12:44:39 Runtime Error in model delete_me (models\delete_me\delete_me.sql)
main is not being called during running model
12:44:39
12:44:39 compiled code at target\compiled\core\models\delete_me\delete_me.sql
12:44:39
12:44:39 Done. PASS=0 WARN=0 ERROR=1 SKIP=0 NO-OP=0 TOTAL=1
I was not able to reproduce the issue you are describing. Could you please share more details on how your model is configured or share a minimal example I can use?
Hi @ericj-db,
I just tested it with your config and it worked. The difference is that we have persist_docs set to False for both relation and columns.
When I tried again with both set to False it failed again:
I also just remembered why we wanted to have persist_docs set to false. As soon as we set this to true, instead of running an ALTER statement, it executes CREATE OR REPLACE again although use_materialization_v2 is set to true. For multiple reasons we want to avoid running CREATE OR REPLACE, one is we lose all assigned permissions to Views
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue.
We re-tested your steps on 1.13.latest with use_materialization_v2 false and true: a view with view_update_via_alter: true and persist_docs relation/columns false, run it, COMMENT ON VIEW, run again. The second run is a no-op and the comment stays. We couldn't reproduce the "main is not being called" error on 1.10.9 or 1.10.14 either, so we can't point to the change that fixed it. Closing; please reopen with your dbt.log if you still see this on 1.13.0.
Activity
benc-db commentedon Jul 16, 2025
@Julian96 what is the actual error you get?
Julian96 commentedon Jul 17, 2025
@benc-db, the error message says "Runtime Error in model (<path_to_model>)
main is not being called during running model". I pasted the terminal prints. In between the 2 runs I created a comment in the UI on the view I created here.
(.venv) PS .\dbt> dbt run --select delete_me
12:43:52 Running with dbt=1.10.3
WARNING:thrift.transport.sslcompat:using legacy validation callback
.\dbt.venv\Lib\site-packages\pydantic_internal_config.py:373: UserWarning: Valid config keys have changed in V2:
'allow_population_by_field_name' has been renamed to 'validate_by_name'
warnings.warn(message, UserWarning)
12:44:00 Registered adapter: databricks=1.10.4
12:44:01 Found 13 models, 12 seeds, 3 data tests, 3 sources, 803 macros
12:44:01
12:44:01 Concurrency: 1 threads (target='dev')
12:44:01
12:44:06 1 of 1 START sql view model delete_me.delete_me ................................ [RUN]
12:44:07 1 of 1 OK created sql view model delete_me.delete_me ........................... [OK in 1.00s]
12:44:08
12:44:08 Finished running 1 view model in 0 hours 0 minutes and 6.60 seconds (6.60s).
12:44:08
12:44:08 Completed successfully
12:44:08
12:44:08 Done. PASS=1 WARN=0 ERROR=0 SKIP=0 NO-OP=0 TOTAL=1
--Added Comment in the UI
(.venv) PS .\dbt> dbt run --select delete_me
12:44:22 Running with dbt=1.10.3
WARNING:thrift.transport.sslcompat:using legacy validation callback
.\dbt.venv\Lib\site-packages\pydantic_internal_config.py:373: UserWarning: Valid config keys have changed in V2:
'allow_population_by_field_name' has been renamed to 'validate_by_name'
warnings.warn(message, UserWarning)
12:44:31 Registered adapter: databricks=1.10.4
12:44:32 Found 13 models, 12 seeds, 3 data tests, 3 sources, 803 macros
12:44:32
12:44:32 Concurrency: 1 threads (target='dev')
12:44:32
12:44:36 1 of 1 START sql view model delete_me.delete_me ................................ [RUN]
12:44:38 1 of 1 ERROR creating sql view model delete_me.delete_me ....................... [ERROR in 2.42s]
12:44:39
12:44:39 Finished running 1 view model in 0 hours 0 minutes and 7.21 seconds (7.21s).
12:44:39
12:44:39 Completed with 1 error, 0 partial successes, and 0 warnings:
12:44:39
12:44:39 Failure in model delete_me (models\delete_me\delete_me.sql)
12:44:39 Runtime Error in model delete_me (models\delete_me\delete_me.sql)
main is not being called during running model
12:44:39
12:44:39 compiled code at target\compiled\core\models\delete_me\delete_me.sql
12:44:39
12:44:39 Done. PASS=0 WARN=0 ERROR=1 SKIP=0 NO-OP=0 TOTAL=1
benc-db commentedon Jul 17, 2025
@ericj-db merged a fix that should address that in 1.10.5, out soon.
Julian96 commentedon Aug 12, 2025
@benc-db, the same error still persists with newer versions.
Python: Python 3.13.6
ericj-db commentedon Aug 13, 2025
Hi @Julian96 I tried to reproduce with different variations of the following
I was using the following config
I was not able to reproduce the issue you are describing. Could you please share more details on how your model is configured or share a minimal example I can use?
Julian96 commentedon Aug 13, 2025
Hi @ericj-db,
I just tested it with your config and it worked. The difference is that we have persist_docs set to False for both relation and columns.
When I tried again with both set to False it failed again:
Julian96 commentedon Aug 13, 2025
I also just remembered why we wanted to have persist_docs set to false. As soon as we set this to true, instead of running an
ALTERstatement, it executesCREATE OR REPLACEagain although use_materialization_v2 is set to true. For multiple reasons we want to avoid runningCREATE OR REPLACE, one is we lose all assigned permissions to Viewsgithub-actions commentedon Apr 11, 2026
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please remove the stale label or comment on the issue.
sd-db commentedon Oct 24, 2026
We re-tested your steps on
1.13.latestwithuse_materialization_v2false and true: a view withview_update_via_alter: trueandpersist_docsrelation/columnsfalse, run it,COMMENT ON VIEW, run again. The second run is a no-op and the comment stays. We couldn't reproduce the "main is not being called" error on 1.10.9 or 1.10.14 either, so we can't point to the change that fixed it. Closing; please reopen with yourdbt.logif you still see this on 1.13.0.