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

support for table constraints #538

Closed
rahulrraj opened this issue May 7, 2021 · 1 comment · Fixed by #1022 or #1332
Closed

support for table constraints #538

rahulrraj opened this issue May 7, 2021 · 1 comment · Fixed by #1022 or #1332
Labels
feature-request Used to mark issues with provider's missing functionalities

Comments

@rahulrraj
Copy link

rahulrraj commented May 7, 2021

Provider Version v0.23.2
Terraform Version Terraform v0.13.1

As per the documentation ,Table column objects only allow name and type property as below
column {
name = "id"
type = "int"
}

It would be nice if it can support CONSTRAINT like PRIMARY, not null etc as documented here.
https://docs.snowflake.com/en/sql-reference/sql/create-table-constraint.html

Is there any workaround to add those constraints with the current version of the provider?

@andre0xFF
Copy link

This is the work around that I am using at the moment:

resource "snowflake_table" "weew" {
  database = "weer"
  schema   = "weeb"
  name     = "weet"
  comment  = "."

  lifecycle {
    ignore_changes = [
        column[0]
    ]
  }

  column {
    name = "id"
    type = "NUMBER(38,0) NOT NULL AUTOINCREMENT CONSTRAINT WE_PK PRIMARY KEY"
  }
}

@alldoami alldoami added the feature-request Used to mark issues with provider's missing functionalities label Jun 15, 2021
@berosen berosen mentioned this issue Jul 8, 2021
1 task
czimergebot pushed a commit that referenced this issue Oct 21, 2021
<!-- Feel free to delete comments as you fill this in -->
Adds support for a column identity/autoincrement for snowflake tables.

Only supports adding an identity to a column for the follow operations
* `CREATE TABLE`
* `ALTER TABLE ADD COLUMN`

<!-- summary of changes -->

## Test Plan
<!-- detail ways in which this PR has been tested or needs to be tested -->
* [x] acceptance tests
* [x] unit tests

## References
* https://docs.snowflake.com/en/sql-reference/sql/create-table.html#optional-parameters (see autoincrement/identity section)
* #538
daniepett pushed a commit to daniepett/terraform-provider-snowflake that referenced this issue Feb 9, 2022
<!-- Feel free to delete comments as you fill this in -->
Adds support for a column identity/autoincrement for snowflake tables.

Only supports adding an identity to a column for the follow operations
* `CREATE TABLE`
* `ALTER TABLE ADD COLUMN`

<!-- summary of changes -->

## Test Plan
<!-- detail ways in which this PR has been tested or needs to be tested -->
* [x] acceptance tests
* [x] unit tests

## References
* https://docs.snowflake.com/en/sql-reference/sql/create-table.html#optional-parameters (see autoincrement/identity section)
* Snowflake-Labs#538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment