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

Added Copy Grants to Snowflake Adapter #1747

Merged

Conversation

Carolus-Holman
Copy link
Contributor

Added Copy Grants to Snowflake Adapter for both Views and Tables, excluding temporary tables.
Usage
{{ config(materialized='table',copy_grants=true) }}

Files Updated: adapters.sql and impl.py for Snowflake Plugin.

@cla-bot cla-bot bot added the cla:yes label Sep 12, 2019
@Carolus-Holman
Copy link
Contributor Author

I noticed the failures were due to the failure of the Database Integration Tests. This is the same thing that happened on my last PR, will I need to followup or redo the PR?

@drewbanin
Copy link
Contributor

hey @Carolus-Holman - I just need to kick off the tests here - I'll do that today! More info on this here: https://github.com/fishtown-analytics/dbt/blob/dev/louisa-may-alcott/CONTRIBUTING.md#submitting-a-pull-request

@@ -9,7 +9,7 @@ class SnowflakeAdapter(SQLAdapter):
ConnectionManager = SnowflakeConnectionManager

AdapterSpecificConfigs = frozenset(
{"transient", "cluster_by", "automatic_clustering", "secure"}
{"transient", "cluster_by", "automatic_clustering", "secure", "copy_grants"}
Copy link
Contributor

Choose a reason for hiding this comment

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

looks like this is a pep8 formatting error. Can you try swinging the copy_grants element onto the next line? There's an example of how to run the flake8 tests locally in the Makefile!

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the linter still isn't happy - can you try something like this?

    AdapterSpecificConfigs = frozenset(
        {"transient", "cluster_by", "automatic_clustering", "secure",
         "copy_grants"}
    )

@drewbanin
Copy link
Contributor

Azure is pointing to the wrong build again - the correct build is passing here: https://dev.azure.com/fishtown-analytics/dbt/_build/results?buildId=690

@drewbanin
Copy link
Contributor

@Carolus-Holman thanks for this PR!

Are you able to squash your 6 commits into a single commit for this PR? Squashing commits is a nice thing to do, as it helps keep the git history clean. We don't require commits to be squashed, but in this case, I think it could be a good idea. Definitely let me know if you'd like a hand with this!

@Carolus-Holman
Copy link
Contributor Author

Need some help Squashing the commits. When I committed the squash? it just added another commit of the .gitnore file.

@drewbanin
Copy link
Contributor

hey @Carolus-Holman - that's pretty strange! I think we'll want to undo the last commit, f09da6a, before rebasing.

Check out the steps below -- these should help you squash your commits into a single commit with a good commit message.

# hard reset your branch to the commit before f09da6a
$ git reset --hard f09da6a^

# "soft" reset your branch to commit `5dc776f8`
# this is the commit that you made changes on top of
$ git reset --soft 5dc776f8

# inspect the git state
$ git status

# commit your changes
$ git commit -m '(#1744) add copy grants option for Snowflake'

# Finally, force push your changes to re-write history. Be careful!
$ git push --force origin dev/louisa-may-alcott

Couple of quick things:

  • in the future, you should make a branch off of dev/louisa-may-alcott for features like this, eg. feature/snowflake-copy-grants. This isn't a problem for dbt -- it will just help keep your local dev environment clean!
  • always be careful when force-pushing to a branch!

Let me know if you have any questions!

@Carolus-Holman
Copy link
Contributor Author

Carolus-Holman commented Sep 17, 2019 via email

Copy link
Contributor

@drewbanin drewbanin left a comment

Choose a reason for hiding this comment

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

Nice work @Carolus-Holman - merging this!

@drewbanin drewbanin merged commit e31a9af into dbt-labs:dev/louisa-may-alcott Sep 18, 2019
@ghost
Copy link

ghost commented May 15, 2022

I am doing dbt Fundamentals course and noticed that even though I set the copy_grants to true on the dbt_project.yml, and the result from the log of dbt run showed the copy grants option, the view created on Snowflake did not have this option at all. Did I miss anything?

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

Successfully merging this pull request may close these issues.

2 participants