10000 fix: Return None when retrieving the oid for an external table by Vitor-Avila · Pull Request #305 · sqlalchemy-redshift/sqlalchemy-redshift · GitHub
[go: up one dir, main page]

Skip to content

fix: Return None when retrieving the oid for an external table #305

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Vitor-Avila
Copy link
@Vitor-Avila Vitor-Avila commented Jun 19, 2024

Todos

  • MIT compatible
  • Tests
  • Documentation
  • Updated CHANGES.rst

Fixes #304

I'm not sure if this is the best way to solve this. I thought about checking the specific exception class, but got stuck on two issues:

  • We would have to handle both the exception raised by psycopg2 and redshift-connector.
  • Given this dialect is supposed to work agnostically with both, we typically wouldn't import these exceptions.

Another approach would be to check the the class name. Something like:

if (
    type(e).__name__ == 'NotSupportedError'
    or type(e).__name__ == 'ProgrammingError'
):

Or check the exception text:

if "Operation not supported on external tables" in str(e):

But these could still be too generic. The suggested approach confirms if the table is indeed external through the metadata -- counterpart is that it executes another query.

Open to suggestions here. :) Once we define on next steps I can look at adding tests/etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_table_oid results in an error for external tables
1 participant
0