Skip to content

Do not include external schemas in search_path#120

Merged
jklukas merged 3 commits into
sqlalchemy-redshift:masterfrom
mjschultz:no-external-schema
May 23, 2017
Merged

Do not include external schemas in search_path#120
jklukas merged 3 commits into
sqlalchemy-redshift:masterfrom
mjschultz:no-external-schema

Conversation

@mjschultz

@mjschultz mjschultz commented May 5, 2017

Copy link
Copy Markdown
Contributor

Amazon's new Redshift Spectrum makes use of external schemas but you cannot set the search_path to include external schemas which breaks reflection. This prevents any external schemas from being added to the search_path.

Todos

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

@jklukas

jklukas commented May 22, 2017

Copy link
Copy Markdown
Member

lgtm. I'll try to run the tests against real Redshift.

WHERE nspname !~ '^pg_'
AND nspname <> 'information_schema'
AND n.oid NOT IN
(SELECT esoid FROM pg_catalog.pg_external_schema)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests against Redshift were failing for this. It looks like schema_names was returning an empty string every time. Pushed this change, moving to a check based on membership in an array populated from a subquery.

@jklukas

jklukas commented May 23, 2017

Copy link
Copy Markdown
Member

I can confirm that this is now passing tests against Redshift with d370d0a

@mjschultz - If the extra commit here looks good to you, I'll go ahead and merge.

@mjschultz

Copy link
Copy Markdown
Contributor Author

lgtm with the new commit. That's what I had used originally. I thought the other form was a bit cleaner but I guess if it doesn't work quite right this is the one to go with.

@jklukas jklukas merged commit 230f874 into sqlalchemy-redshift:master May 23, 2017
@jklukas

jklukas commented May 23, 2017

Copy link
Copy Markdown
Member

Thanks for submitting this, @mjschultz!

@mjschultz mjschultz deleted the no-external-schema branch February 5, 2020 20:25
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