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

Detect schema without tables in schema_exists #30

Merged
merged 4 commits into from
Sep 7, 2023

Conversation

marcusmunch
Copy link
Collaborator

Turns out one of the issues I had regarding setting up GitHub actions was that schema_exists would always return FALSE unless a table existed in the schema.

This is now fixed by trying to create a table (and immediately deleting it) if no tables were found within the schema. This does mean that the function will always return FALSE on a schema with no tables if the user does not have CREATE TABLE privileges.

A more hands-off, backend-specific (i.e. PostgreSQL-specific) solution could be made, but I opted for a potentially wider usable method.

@marcusmunch marcusmunch added the bug Something isn't working label Sep 7, 2023
@marcusmunch marcusmunch self-assigned this Sep 7, 2023
@marcusmunch marcusmunch marked this pull request as ready for review September 7, 2023 11:17
Copy link
Contributor

@RasmusSkytte RasmusSkytte left a comment

Choose a reason for hiding this comment

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

Approved with a single suggestion

R/get_schema.R Outdated Show resolved Hide resolved
R/get_schema.R Outdated Show resolved Hide resolved
R/get_schema.R Outdated Show resolved Hide resolved
@marcusmunch marcusmunch merged commit fbc62bd into main Sep 7, 2023
10 of 11 checks passed
@marcusmunch marcusmunch deleted the register-empty-schema branch September 7, 2023 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants