Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression] Sporadic "cannot open relation with oid ###" error #974

Open
2 tasks done
mikealfare opened this issue Jan 10, 2025 · 0 comments
Open
2 tasks done

[Regression] Sporadic "cannot open relation with oid ###" error #974

mikealfare opened this issue Jan 10, 2025 · 0 comments

Comments

@mikealfare
Copy link
Contributor

Is this a regression in a recent version of dbt-redshift?

  • I believe this is a regression in dbt-redshift functionality
  • I have searched the existing issues, and I could not find an existing issue for this regression

Current Behavior

When executing a dbt run with multiple models using multiple threads, I sometimes receive an error message like:

Database Error
  could not open relation with OID 123456789

I can resolve it by rerunning the failed models manually. I can also reduce how often I need to run this manually by increasing the retries parameter.

Expected/Previous Behavior

Prior to moving to the Redshift driver, I did not see this error. I would expect the same behavior with the Redshift driver.

Steps To Reproduce

Create several models and run them in parallel. The more threads and the smaller the models, the more likely you'll see it. Because it's not deterministic, you may not see it every time.

Relevant log output

No response

Environment

- OS: any
- Python: any
- dbt-redshift (working version): Postgres driver versions (<1.5)
- dbt-redshift (regression version): Redshift driver versions (1.5+)

Additional Context

I believe this is happening because the Redshift driver does not handle multi-statement SQL as a single transaction whereas the Postgres driver does handle multi-statement SQL as a single transaction. While the Redshift approach complies with the DBAPI 2.0 spec (and the Postgres approach does not), this adapter was built with the assumptions associated with the Postgres driver. When we updated from Postgres to Redshift, we did not account for all of the places where the Postgres-based assumptions no longer hold.

@mikealfare mikealfare added bug Something isn't working triage regression and removed bug Something isn't working triage labels Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant