simple-ddl-parser icon indicating copy to clipboard operation
simple-ddl-parser copied to clipboard

support for Snowflake Terraform provider column(?) format generation

Open gliptak opened this issue 4 years ago • 4 comments

Is your feature request related to a problem? Please describe.

Many DB tools generate DDL (with various extensions) and looking for conversion into Snowflake Terraform format

Describe the solution you'd like

Support https://registry.terraform.io/providers/chanzuckerberg/snowflake/latest/docs/resources/table#nested-schema-for-column

Example syntax:

  column {
    name     = "data"
    type     = "text"
    nullable = false
  }

or maybe support for snowflake_table although snowflake_table would likely refer to other components/variables in the TF files

Additional context

https://github.com/chanzuckerberg/terraform-provider-snowflake/discussions/685

gliptak avatar Sep 22 '21 13:09 gliptak

@gliptak I can create a separate tool for this. I pretty sure that it must be a separate from parser. I can do it on this weekends. Something like ddl-to-tf-snowflake-table. I have already table-meta(https://github.com/xnuinside/table-meta ) that map in simple way output from ddl parser, so only one thing that I should do - it's create a mapping between table-meta columns and expected format of terraform-provider-snowflake config

xnuinside avatar Sep 22 '21 14:09 xnuinside

@xnuinside thank you for the pointer to https://github.com/xnuinside/table-meta. I will review

If snowflake_table is targeted for generation (with hardcoded values), than it is full cycle (can go DDL -> TF -> DDL).

If it is snowflake_table_column only, might fit better with table-meta. For my usecase, I'm thinking of substituting only a columns into a TF maintained separately

gliptak avatar Sep 22 '21 15:09 gliptak

did not have a chance to start working on this last weekends ( sorry

xnuinside avatar Sep 27 '21 07:09 xnuinside

@xnuinside no worries. please let me know if/how I might help out

gliptak avatar Sep 27 '21 12:09 gliptak