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

TERRA-114 ⁃ Support table definitions from CREATE statements #239

Open
SpencerC opened this issue May 11, 2023 · 0 comments
Open

TERRA-114 ⁃ Support table definitions from CREATE statements #239

SpencerC opened this issue May 11, 2023 · 0 comments

Comments

@SpencerC
Copy link

SpencerC commented May 11, 2023

The current approach requires describing table schemas through a bespoke representation. I'd wager most clients with explicit schemas have them defined in CREATE statement form.

Current Approach

resource "astra_database" "dev" {
  name           = "puppies"
  keyspace       = "puppies"
  cloud_provider = "gcp"
  regions        = ["us-east1"]
}
resource "astra_table" "table-1" {
  table       = "mytable"
  keyspace = "puppies"
  database_id = astra_database.dev.id
  region = "us-east1"
  clustering_columns = "a:b"
  partition_keys = "c:d"
  column_definitions= [
    {
      Name: "a"
      Static: false
      TypeDefinition: "text"
    },
    {
      Name: "b"
      Static: false
      TypeDefinition: "text"
    },
    ...
  ]
} 

Proposed Approach

environments/prod/main.tf:

resource "astra_database" "dev" {
  name           = "puppies"
  keyspace       = "puppies"
  cloud_provider = "gcp"
  regions        = ["us-east1"]
}
resource "astra_table" "table-1" {
  keyspace = "puppies"
  database_id = astra_database.dev.id
  region = "us-east1"
  schema_path = "../../db/mytable.cql"
} 

db/mytable.cql:

CREATE TABLE mytable
(
    a   TEXT,
    b  TEXT,
    ...
    PRIMARY KEY ((c,d), a, b)
);

┆Issue is synchronized with this Jira Task by Unito
┆Issue Number: TERRA-114
┆Priority: Major

@sync-by-unito sync-by-unito bot changed the title Support table definitions from CREATE statements TERRA-114 ⁃ Support table definitions from CREATE statements May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant