|
| 1 | +================================================================================ |
| 2 | +DBT ANALYTICS ENGINEERING — CI/CD PIPELINE FAILURE ANALYSIS |
| 3 | +================================================================================ |
| 4 | +Generated: 2026-06-20 |
| 5 | +Repository: Ritik574-coder/dbt-analytics-engineering |
| 6 | +Branch with failures: dbt_branch (PR to main) |
| 7 | + |
| 8 | +SUMMARY |
| 9 | +------- |
| 10 | +All three GitHub Actions workflows are currently failing: |
| 11 | + |
| 12 | + Workflow Latest failed run Failing job/step |
| 13 | + ---------------- ------------------ ------------------------------------------ |
| 14 | + dbt CI 27859117241 dbt integration → Load Bronze Data |
| 15 | + dbt Docs 27859117248 Generate documentation → Generate dbt docs |
| 16 | + dbt CD 27839146670 Deploy (prod) → dbt debug |
| 17 | + |
| 18 | +The "Lint & parse" CI job passes. Failures are in database connectivity / setup. |
| 19 | + |
| 20 | + |
| 21 | +================================================================================ |
| 22 | +ISSUE 1 — DATABASE NAME MISMATCH (CI + DOCS) — PRIMARY BLOCKER |
| 23 | +================================================================================ |
| 24 | + |
| 25 | +SEVERITY: Critical (blocks CI and Docs right now) |
| 26 | + |
| 27 | +EXACT REASON: |
| 28 | + GitHub Actions workflows set: |
| 29 | + DBT_SQLSERVER_DATABASE: retail_analytics |
| 30 | + |
| 31 | + But the database initialization script creates a different database: |
| 32 | + scripts/ci-init-db.sql → CREATE DATABASE RetailDB |
| 33 | + |
| 34 | + When python_load.py and dbt connect, they use the env var |
| 35 | + DBT_SQLSERVER_DATABASE=retail_analytics. That database does NOT exist |
| 36 | + on the CI SQL Server container. SQL Server returns error 4060: |
| 37 | + |
| 38 | + Cannot open database "retail_analytics" requested by the login. |
| 39 | + The login failed. (4060) |
| 40 | + |
| 41 | + Evidence from latest CI run (27859117241), step "Load Bronze Data": |
| 42 | + - ci-init-db.sql succeeded: "Changed database context to 'RetailDB'." |
| 43 | + - python_load.py failed immediately trying to connect to retail_analytics |
| 44 | + |
| 45 | + Same error in dbt Docs run (27859117248), step "Generate dbt docs": |
| 46 | + dbt docs generate cannot connect because retail_analytics does not exist. |
| 47 | + |
| 48 | +AFFECTED FILES: |
| 49 | + - .github/workflows/dbt-ci.yml (remote/pushed version still has retail_analytics) |
| 50 | + - .github/workflows/dbt-docs.yml (still has retail_analytics) |
| 51 | + - scripts/ci-init-db.sql (creates RetailDB) |
| 52 | + - scripts/loading/python_load.py (defaults to RetailDB, but CI env overrides it) |
| 53 | + - models/staging/_retail__sources.yml (correctly references database: RetailDB) |
| 54 | + - profiles.example.yml / .env.example (default to retail_analytics — confusing) |
| 55 | + |
| 56 | +NOTE: |
| 57 | + You have a LOCAL uncommitted fix in dbt-ci.yml changing retail_analytics → RetailDB, |
| 58 | + but it is NOT pushed to GitHub yet, and dbt-docs.yml was NOT updated. |
| 59 | + |
| 60 | +HOW TO FIX: |
| 61 | + 1. Use ONE database name everywhere. Recommended: RetailDB (matches init script, |
| 62 | + DDL, sources, and bronze load scripts). |
| 63 | + |
| 64 | + 2. Update workflow env vars: |
| 65 | + .github/workflows/dbt-ci.yml: |
| 66 | + DBT_SQLSERVER_DATABASE: RetailDB |
| 67 | + |
| 68 | + .github/workflows/dbt-docs.yml: |
| 69 | + DBT_SQLSERVER_DATABASE: RetailDB |
| 70 | + |
| 71 | + 3. Commit and push both workflow changes to dbt_branch. |
| 72 | + |
| 73 | + 4. Optionally align defaults for local dev consistency: |
| 74 | + .env.example → DBT_SQLSERVER_DATABASE=RetailDB |
| 75 | + profiles.example.yml → default 'RetailDB' instead of 'retail_analytics' |
| 76 | + |
| 77 | + 5. Re-run CI after push. Bronze load + dbt run should proceed past current failure. |
| 78 | + |
| 79 | + |
| 80 | +================================================================================ |
| 81 | +ISSUE 2 — BRONZE TABLES NOT LOADED (CI — secondary failure after Issue 1) |
| 82 | +================================================================================ |
| 83 | + |
| 84 | +SEVERITY: High (appeared in earlier CI runs once DB connection partially worked) |
| 85 | + |
| 86 | +EXACT REASON: |
| 87 | + In CI run 27840802070, dbt run reached execution but all 8 staging models failed: |
| 88 | + |
| 89 | + Invalid object name 'RetailDB.bronze.customers'. (208) |
| 90 | + Invalid object name 'RetailDB.bronze.employees'. (208) |
| 91 | + ... (same for all bronze source tables) |
| 92 | + |
| 93 | + This means dbt connected, but bronze tables were missing or empty. |
| 94 | + Root cause chain: |
| 95 | + a) python_load.py never loaded data (database name mismatch), OR |
| 96 | + b) ddl_bronze.sql was not run before dbt run, OR |
| 97 | + c) Load step was missing from an older workflow version |
| 98 | + |
| 99 | + Current workflow (dbt-ci.yml) does have the correct sequence: |
| 100 | + 1. ci-init-db.sql → create RetailDB + schemas |
| 101 | + 2. ddl_bronze.sql → create bronze tables |
| 102 | + 3. python_load.py → load CSV data into bronze.* |
| 103 | + 4. dbt run → build staging/intermediate models |
| 104 | + |
| 105 | + Fixing Issue 1 should allow steps 1–3 to complete and prevent this error. |
| 106 | + |
| 107 | +HOW TO FIX: |
| 108 | + 1. Fix Issue 1 first (RetailDB name alignment). |
| 109 | + 2. Verify CI log shows after python_load.py: |
| 110 | + "Loaded N rows into bronze.customers" (for each table) |
| 111 | + 3. If tables still missing, confirm CSV files exist in repo: |
| 112 | + scripts/raw_dataset/csv_data_file/*.csv (all 8 files present ✓) |
| 113 | + 4. Confirm ddl_bronze.sql runs without error before python_load.py. |
| 114 | + |
| 115 | + |
| 116 | +================================================================================ |
| 117 | +ISSUE 3 — CD PIPELINE CANNOT REACH PRODUCTION SQL SERVER |
| 118 | +================================================================================ |
| 119 | + |
| 120 | +SEVERITY: Critical (blocks all CD deployments) |
| 121 | + |
| 122 | +EXACT REASON: |
| 123 | + CD workflow (dbt-cd.yml) fails at "dbt debug" with: |
| 124 | + |
| 125 | + Login timeout expired (HYT00) |
| 126 | + Connection test: [ERROR] |
| 127 | + |
| 128 | + This means the GitHub Actions runner waited ~60+ seconds and could NOT |
| 129 | + establish a TCP connection to the SQL Server defined in GitHub Secrets. |
| 130 | + |
| 131 | + CD does NOT use a local SQL Server container. It connects to a real server |
| 132 | + via repository/environment secrets: |
| 133 | + DBT_SQLSERVER_HOST |
| 134 | + DBT_SQLSERVER_PORT |
| 135 | + DBT_SQLSERVER_DATABASE |
| 136 | + DBT_SQLSERVER_SCHEMA |
| 137 | + DBT_SQLSERVER_USER |
| 138 | + DBT_SQLSERVER_PASSWORD |
| 139 | + |
| 140 | + Login timeout (not "login failed") typically means: |
| 141 | + - Host is unreachable (wrong IP/hostname, localhost, private network) |
| 142 | + - Firewall blocks GitHub Actions runner IP ranges |
| 143 | + - SQL Server not listening on the configured port |
| 144 | + - Azure SQL / cloud DB requires firewall rule for GitHub Actions |
| 145 | + - Secrets not configured in the "production" GitHub Environment |
| 146 | + |
| 147 | + All recent CD runs fail the same way (runs: 27839146670, 27750986715, |
| 148 | + 27735843782, 27623198237). |
| 149 | + |
| 150 | +HOW TO FIX: |
| 151 | + 1. In GitHub → Settings → Environments → production → verify ALL 6 |
| 152 | + DBT_SQLSERVER_* secrets are set (not empty, not localhost). |
| 153 | + |
| 154 | + 2. DBT_SQLSERVER_HOST must be a publicly reachable hostname/IP |
| 155 | + (e.g. your Azure SQL server: myserver.database.windows.net). |
| 156 | + localhost / 127.0.0.1 will ALWAYS fail in GitHub Actions. |
| 157 | + |
| 158 | + 3. Open firewall for GitHub Actions: |
| 159 | + - Azure SQL: enable "Allow Azure services" OR add GitHub IP ranges |
| 160 | + - On-prem SQL Server: allow inbound TCP 1433 from GitHub Actions IPs |
| 161 | + (or use a self-hosted runner inside your network) |
| 162 | + |
| 163 | + 4. Verify SQL Server accepts SQL authentication (not Windows-only auth). |
| 164 | + |
| 165 | + 5. Test connectivity manually from outside your network: |
| 166 | + sqlcmd -S <host>,<port> -U <user> -P <password> -C -Q "SELECT 1" |
| 167 | + |
| 168 | + 6. Ensure ODBC Driver 18 settings match your server (trust_cert: true is |
| 169 | + already set in profiles.example.yml). |
| 170 | + |
| 171 | + 7. Re-run CD via Actions → dbt CD → Run workflow. |
| 172 | + |
| 173 | + |
| 174 | +================================================================================ |
| 175 | +ISSUE 4 — INCONSISTENT DATABASE NAMING ACROSS PROJECT |
| 176 | +================================================================================ |
| 177 | + |
| 178 | +SEVERITY: Medium (causes confusion and repeat failures) |
| 179 | + |
| 180 | +EXACT REASON: |
| 181 | + The project uses two different database names: |
| 182 | + - RetailDB → ci-init-db.sql, ddl_bronze.sql, sources.yml, proc scripts |
| 183 | + - retail_analytics → workflows, .env.example, profiles.example.yml |
| 184 | + |
| 185 | + dbt profile connects to one database (from env var), while source() macros |
| 186 | + hardcode database: RetailDB in _retail__sources.yml. This can work in SQL |
| 187 | + Server (cross-database queries) ONLY if both databases exist. In CI, only |
| 188 | + RetailDB is created — retail_analytics never exists. |
| 189 | + |
| 190 | +HOW TO FIX: |
| 191 | + Standardize on RetailDB everywhere, OR rename ci-init-db.sql to create |
| 192 | + retail_analytics instead. Pick one name and update all references. |
| 193 | + |
| 194 | + |
| 195 | +================================================================================ |
| 196 | +ISSUE 5 — DOCS WORKFLOW MISSING BRONZE SETUP (minor / future) |
| 197 | +================================================================================ |
| 198 | + |
| 199 | +SEVERITY: Low (docs generate may work without bronze data, but DB must exist) |
| 200 | + |
| 201 | +EXACT REASON: |
| 202 | + dbt-docs.yml only runs ci-init-db.sql, then dbt docs generate. |
| 203 | + It does NOT run ddl_bronze.sql or python_load.py. |
| 204 | + |
| 205 | + dbt docs generate needs a valid DB connection but does not require bronze |
| 206 | + data. Fixing the database name (Issue 1) should be enough for Docs to pass. |
| 207 | + |
| 208 | +HOW TO FIX: |
| 209 | + 1. Fix DBT_SQLSERVER_DATABASE in dbt-docs.yml → RetailDB. |
| 210 | + 2. No bronze load needed unless you add compile/run steps that query sources. |
| 211 | + |
| 212 | + |
| 213 | +================================================================================ |
| 214 | +ISSUE 6 — WORKFLOW HYGIENE (non-blocking but worth fixing) |
| 215 | +================================================================================ |
| 216 | + |
| 217 | +SEVERITY: Low |
| 218 | + |
| 219 | +EXACT REASON: |
| 220 | + a) dbt-ci.yml has two steps both named "Create Bronze Tables" (lines 133–139). |
| 221 | + Makes debugging CI logs harder. |
| 222 | + |
| 223 | + b) SQL Server service health check uses: |
| 224 | + /opt/mssql-tools18/bin/sqlcmd |
| 225 | + inside the mcr.microsoft.com/mssql/server:2022-latest container. |
| 226 | + The container image may ship sqlcmd at a different path. CI currently |
| 227 | + works (sqlcmd on the runner host is used for steps), but the service |
| 228 | + health check path may be unreliable. |
| 229 | + |
| 230 | + c) dbt_project.yml has unused config paths (marts, seeds, snapshots) — |
| 231 | + warnings only, not causing failures. |
| 232 | + |
| 233 | +HOW TO FIX: |
| 234 | + a) Rename steps: "Initialize CI database" and "Create bronze DDL tables". |
| 235 | + b) Change health-cmd to use runner-side check or correct container path: |
| 236 | + /opt/mssql-tools18/bin/sqlcmd OR /opt/mssql-tools/bin/sqlcmd |
| 237 | + c) Add marts/seeds/snapshots content or remove unused config blocks. |
| 238 | + |
| 239 | + |
| 240 | +================================================================================ |
| 241 | +RECOMMENDED FIX ORDER |
| 242 | +================================================================================ |
| 243 | + |
| 244 | + Step Action Expected result |
| 245 | + ---- -------------------------------------------------- ------------------------- |
| 246 | + 1 Push RetailDB fix to dbt-ci.yml AND dbt-docs.yml CI + Docs pass DB connect |
| 247 | + 2 Verify bronze load + dbt run/test in CI logs Full CI green |
| 248 | + 3 Fix CD secrets + firewall for production SQL Server CD deploys succeed |
| 249 | + 4 Align .env.example / profiles.example.yml Local dev matches CI |
| 250 | + |
| 251 | + |
| 252 | +================================================================================ |
| 253 | +WHAT IS ALREADY WORKING |
| 254 | +================================================================================ |
| 255 | + |
| 256 | + ✓ Lint & parse job (YAML validation, dbt parse, sqlfluff) — passes |
| 257 | + ✓ Python dependencies install (dbt-core, pandas, sqlalchemy, pyodbc) |
| 258 | + ✓ ODBC Driver 18 install on Ubuntu runner |
| 259 | + ✓ SQL Server container starts and accepts sqlcmd from runner |
| 260 | + ✓ ci-init-db.sql creates RetailDB + bronze + dbt_ci schemas |
| 261 | + ✓ ddl_bronze.sql creates bronze tables (when run against RetailDB) |
| 262 | + ✓ CSV seed files exist in scripts/raw_dataset/csv_data_file/ |
| 263 | + ✓ dbt models compile (35 models found in latest parse) |
| 264 | + |
| 265 | + |
| 266 | +================================================================================ |
| 267 | +QUICK REFERENCE — EXACT ERROR MESSAGES FROM GITHUB ACTIONS |
| 268 | +================================================================================ |
| 269 | + |
| 270 | +CI (latest): |
| 271 | + sqlalchemy.exc.ProgrammingError: Cannot open database "retail_analytics" |
| 272 | + requested by the login. The login failed. (4060) |
| 273 | + |
| 274 | +Docs (latest): |
| 275 | + Database Error: Cannot open database "retail_analytics" requested by the |
| 276 | + login. The login failed. (4060) |
| 277 | + |
| 278 | +CI (earlier, after partial progress): |
| 279 | + Invalid object name 'RetailDB.bronze.customers'. (208) |
| 280 | + |
| 281 | +CD (all recent runs): |
| 282 | + Login timeout expired (HYT00) — Connection test: [ERROR] |
| 283 | + |
| 284 | +================================================================================ |
| 285 | +END OF REPORT |
| 286 | +================================================================================ |
0 commit comments