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

Quoting issues #261

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

Conversation

Honza-m
Copy link

@Honza-m Honza-m commented Jan 20, 2023

Hi,

I've run into the issue described here and partially fixed here. On my project, it seems like Redshift will not only quote the table name, but also the schema name in some instances, which breaks more stuff than the initial fix addresses.

By unquoting the schema and table names in a couple of extra places, I was able to get my project to autogenerate migrations for the offending schemas without issues. The problems mostly occurred around foreign key resolving, as far as I can tell.

These changes worked for my project, but I'm unfamiliar with inner workings of sqlalchemy dialects, so if there is a better place for unquoting the names please let me know. I've also struggled with coming up with unit tests for these changes, so any advise would be much appreciated.

@Tin-Nguyen
Copy link

Tin-Nguyen commented Oct 3, 2023

Anyone did look into this improvement? It seems this is what I'm facing too. I'm trying to generate the SQL query including the external schema's tables however the generated SQL is formatted with the double quotes on the schema name or table name. Redshift isn't supporting the quotes in the query though

@Tin-Nguyen
Copy link

@Honza-m I figured out the change isn't fixing my issue. I'm setting the schema = dotted.schema however the dialect still return the SQL query with the double quotes wrapping the schema name. I also figured out the workaround solution that we can use quote_schema=False under the SQLAlchemy table definition that helps to remove the double quotes however I think the best fix is to let the dialect itself to remove the quotes automatically. I haven't figured out how to update it yet. Will keep you posted

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.

2 participants