Skip to content

Support ARRAY types #13

@apstndb

Description

@apstndb

splanter seems to support all Cloud Spanner table column types except ARRAY types.
Ideally, ARRAY types should be supported.

Schama

CREATE TABLE AllTypes (
                     ID STRING(MAX) NOT NULL,
                     BoolValue BOOL,
                     Int64Value INT64,
                     Float64Value FLOAT64,
                     TimestampValue TIMESTAMP,
                     DateValue DATE,
                     StringValue STRING(MAX),
                     BytesValue BYTES(MAX),
                     NumericValue NUMERIC,
                     JSONValue JSON,
                     StringArray ARRAY<STRING(MAX)>,
) PRIMARY KEY(ID);

YAML

---
# Values are need to be encoded as documented.
# https://cloud.google.com/spanner/docs/reference/rpc/google.spanner.v1#google.spanner.v1.TypeCode
- ID: "All_Type_Values"
  BoolValue: true
  BytesValue: "aG9nZQ==" # base64("hoge")
  DateValue: "2022-04-01"
  Float64Value: 3.14159
  Int64Value: 42
  JSONValue: '{"test": 1}'
  NumericValue: "-12345678901234567890123456789.123456789"
  StringValue: "FooBar"
  TimestampValue: "2022-04-01T00:00:00Z"
  # failed to load data to spanner tables: failed to insert records: spanner: code = "InvalidArgument", desc = "client doesn't support type []interface {}"exit status 1
  # StringArray:
  #   - "Foo"
  #   - "Bar"

In this case, it seems to need []interface{}-to-[]string conversion(using INFORMATION_SCHEMA or use reflection?). ARRAY<INT64>, ARRAY<TIMESTAMP>, etc are also should be supported

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions