Replies: 6 comments 9 replies
-
Yeah, currently SnowDDL expects all objects in schema to be owned by "schema owner" role or by SnowDDL admin role. Otherwise it will not work well with env_prefix feature, since objects managed outside of SnowDDL are not going to be replicated. Even if I add some extra checks, it won't fix this fundamental issue. I suggest to consider the following options:
|
Beta Was this translation helpful? Give feedback.
-
By the way, future grants which are automatically assigned to "schema owner" role should currently change ownership for tables and pipes created by Terraform. Ownership will be assigned to "schema owner" role automatically via future grant. You won't be able to distinguish tables in single schema into multiple types by ownership, since future grants applies to all tables equally. |
Beta Was this translation helpful? Give feedback.
-
@littleK0i I'd like to add a point regarding the first suggestion you made: We could run into the following issue: Let's say SnowDDL is supposed to create a view that points to a table created by Terraform, meaning it's in the schema dedicated to Terraform as you suggested. My understanding is, when SnowDDL runs the statement "create view as select from [Terraform table]", this operation would fail because for the SnowDDL ROLE, this table doesn't exist, correct? |
Beta Was this translation helpful? Give feedback.
-
Thank you for the suggested options; we are considering which one might be the best for our case. We have also thought of another option that would require a new feature in SnowDDL, but perhaps it's simple to implement and could be useful for other use cases as well. All our objects created via Terraform have specific prefixes. Just as there is an argument to exclude objects by type ( Thank you very much! |
Beta Was this translation helpful? Give feedback.
-
Thank you @littleK0i While this sounds like a good option, it might not be necessary for my use case. Here's why: Database Schemas Overview:
Purpose of Schemas: Tools: Snowflake Roles Overview:
Solution Proposal: Reasons: And the most important part, no one besides TERRAFORM can create objects there. It can't truly function as a SANDBOX, as the ADMIN_DB role lacks permissions. That's the idea, wdyt? |
Beta Was this translation helpful? Give feedback.
-
@mirkanos , please note. I've recently updated SnowDDL. It is now possible to define config programmatically in pure Python without any overloading. All you need to do is add basic Python modules to config directory. You may use any external data sources and any other Python packages. Hopefully, it will simplify things a little bit. More about this feature: https://docs.snowddl.com/advanced/programmatic-config Thank you. |
Beta Was this translation helpful? Give feedback.
-
We are starting to use SnowDDL in SingleDB mode.
Our goal is to handle at least Stages/Pipes/(raw)Tables via Terraform (with Terraform ownership) and downstream tables and the rest of the objects via SnowDDL (with its ownership).
When we generate the plan without including YAML files for tables owned by Terraform, SnowDDL plans to drop them, even if it can't do that since Terraform's role owns them. As far as I know, SnowDDL should completely ignore objects owned by other roles, but in this case, it plans a drop (which later fails, obviously).
Any suggestion?
We discard the option of creating two separate schemas and using the is_sandbox flag :)
Beta Was this translation helpful? Give feedback.
All reactions