dbt-sqlserver: Retry model on connection errors

Hey Guys,

Is it possible to implement re-trying of queries if the query fails due to non-model related errors?

For example, sometimes Azure SQL fails with errors like this:

[2021-02-24 05:50:02,777] {dbt_rpc.py:83} INFO - Failed model `base_signups`: Database Error in model base_thrive_leads_signups (models/02_base/base_signups.sql)
  ('08S01', '[08S01] [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: Error code 0x68 (104) (SQLExecDirectW)')
  compiled SQL at target/run/my_project/models/02_base/base_signups.sql

This is particularly frustrating in daily, automated runs through airlfow. I have solved it for now by adding retry logic through airflow that re-runs only failed and skipped models, but perhaps it would be worthwhile solving this at the dbt-sqlserver level for everyone?

Thanks, kim

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (3 by maintainers)

Most upvoted comments

The dbt-sqlserver 1.2.0 release includes an option retries in the target configuration which should mitigate these kinds of issues. Let me know if that doesn’t work for you so that I can reopen this issue.

Hi This is azure sql.

Encountered an error while running operation: Database Error 123 ('28000', "[28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user ''. (18456) (SQLDriverConnect)")

I think we’ve got one for just the thing: https://github.com/dbt-labs/dbt-redshift/issues/96

(though the fix would more likely come in https://github.com/dbt-labs/dbt-core/issues/5022)