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

dynamic table dolumns not working #140

Open
justas200 opened this issue Jun 25, 2024 · 0 comments
Open

dynamic table dolumns not working #140

justas200 opened this issue Jun 25, 2024 · 0 comments

Comments

@justas200
Copy link

Hello,

Is dynamic table columns functionality working? Hashicorp example

variable "columns" {
  type = list(object({
    name    = string
    type    = string
    null    = bool
  }))

  default = [
    {
      name    = "time_ch"
      type    = "DateTime"
      null    = false
    }
  ]
}


table "table_example" {
  schema = schema.database_example
  engine = MergeTree
  settings = {
    index_granularity          = 8192
  }
  dynamic "column" {
    for_each = var.columns
    content {
      name = column.value.name
      type = column.value.type
    }
  }
}

The following code produces an error

│ Error: Inspect Error
│ 
│   with data.atlas_schema.table_example,
│   on exchange-scraper.tf line 2, in data "atlas_schema" "table_example":
│    2: data "atlas_schema" "table_example" {
│ 
│ Unable to inspect given source, got error: panic: runtime error: comparing uncomparable type cty.typeObject
│ 
│ goroutine 1 [running]:
│ ariga.io/atlas/schemahcl.(*State).toAttrs(0x14000546600, 0x140007aff20, {0x10625a8d8, 0x140008f8f80}, 0x140010018c0, {0x140008f6c40, 0x2, 0x2})
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/schemahcl/schemahcl.go:616 +0x864
│ ariga.io/atlas/schemahcl.(*State).toResource(0x14000546600, 0x140007aff20, {0x10625a8d8, 0x140008f8f80}, 0x140009357a0, {0x140008f6c40, 0x2, 0x2},
│ 0x14000bbfb30)
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/schemahcl/schemahcl.go:722 +0x1b8
│ ariga.io/atlas/schemahcl.(*State).toResource(0x14000546600, 0x140007afe78, {0x10625a8d8, 0x140008f8f80}, 0x140009358c0, {0x14001466d48, 0x1, 0x1},
│ 0x140008fc120)
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/schemahcl/schemahcl.go:733 +0x418
│ ariga.io/atlas/schemahcl.(*State).resource(0x14000546600, 0x14000df3c20, {0x10625a8d8, 0x140008f8f80}, 0x0?, 0x14000f80b40)
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/schemahcl/schemahcl.go:522 +0x2e4
│ ariga.io/atlas/schemahcl.(*State).Eval(0x14000546600, 0x14000da00d8, {0x105c6bee0, 0x14000cce480}, 0x0)
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/schemahcl/schemahcl.go:409 +0x73c
│ ariga.io/atlas/sql/clickhouse.evalSpec(0x14000da00d8, {0x105fe74e0?, 0x140001b0af0}, 0x0)
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/sql/clickhouse/sqlspec_ent.go:258 +0xa0
│ ariga.io/atlas/schemahcl.EvalFunc.Eval(0x140014675e8?, 0x104086380?, {0x105fe74e0?, 0x140001b0af0?}, 0x1?)
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/schemahcl/schemahcl.go:1068 +0x3c
│ ariga.io/atlas/cmd/atlas/internal/cmdext.stateReaderHCL({0x140014677f8?, 0x4?}, 0x140001a7260, {0x14000942880, 0x1, 0x1})
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/cmd/atlas/internal/cmdext/reader.go:186 +0x10c
│ ariga.io/atlas/cmd/atlas/internal/cmdext.StateReaderHCL({0x10625a718, 0x14000b887e0}, 0x140001a7260)
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/cmd/atlas/internal/cmdext/reader.go:167 +0x11c
│ ariga.io/atlas/cmd/atlas/internal/cmdapi.stateReader({0x10625a718, 0x14000b887e0}, 0x14000ddcb40, 0x14001467a08)
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/cmd/atlas/internal/cmdapi/cmdapi.go:545 +0x260
│ ariga.io/atlas/cmd/atlas/internal/cmdapi.schemaInspectRun(0x14000dda308, {0x0?, 0x0?, 0x0?}, {{0x16cf371c2, 0x50}, {0x16cf3721d, 0x2f}, {0x0, 0x0},
│ ...}, ...)
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/cmd/atlas/internal/cmdapi/schema.go:521 +0x1e0
│ ariga.io/atlas/cmd/atlas/internal/cmdapi.schemaInspectCmdEnt.func2(0x14000dda308?, {0x140009e2900?, 0x4?, 0x104ec2fcf?})
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/cmd/atlas/internal/cmdapi/cmdapi_ent.go:462 +0x1d4
│ github.com/spf13/cobra.(*Command).execute(0x14000dda308, {0x140009e28c0, 0x4, 0x4})
│       /Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:983 +0x840
│ github.com/spf13/cobra.(*Command).ExecuteC(0x107b449e0)
│       /Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115 +0x344
│ github.com/spf13/cobra.(*Command).Execute(...)
│       /Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
│ github.com/spf13/cobra.(*Command).ExecuteContext(0x10625a718?, {0x10625a718?, 0x14000b887e0?})
│       /Users/runner/go/pkg/mod/github.com/spf13/[email protected]/command.go:1032 +0x48
│ main.main()
│       /Users/runner/work/atlas-enterprise/atlas-enterprise/cmd/atlas/main.go:52 +0x108
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