简体   繁体   English

GCP Spanner 支持结构数组

[英]GCP Spanner support array of structs

Does Spanner support array of structs? Spanner 是否支持结构数组?

The following DDL generates errors:以下 DDL 生成错误:

CREATE TABLE table1 (
    col1 BYTES(MAX) NOT NULL,
    col2 STRING(36) NOT NULL,
    col3 TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true),
    col4 TIMESTAMP NOT NULL,
     labels array<struct<
      name STRING NOT NULL,
      last_updated timestatmp NOT NULL>>, 
    col5 INT64 NOT NULL,
    col6 STRING(36) NOT NULL,
    col7 STRING(36) NOT NULL,
) PRIMARY KEY (col1);

Error parsing Spanner DDL statement: CREATE TABLE table1 ( col1 BYTES(MAX) NOT NULL, col2 STRING(36) NOT NULL, col3 TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true), col4 TIMESTAMP NOT NULL, labels array>, col5 INT64 NOT NULL, col6 STRING(36) NOT NULL, col7 STRING(36) NOT NULL, ) PRIMARY KEY (col1): Syntax error on line 6, column 19: Encountered 'struct' while parsing: column_type Error parsing Spanner DDL statement: CREATE TABLE table1 ( col1 BYTES(MAX) NOT NULL, col2 STRING(36) NOT NULL, col3 TIMESTAMP NOT NULL OPTIONS (allow_commit_timestamp=true), col4 TIMESTAMP NOT NULL, labels array>, col5 INT64 NOT NULL , col6 STRING(36) NOT NULL, col7 STRING(36) NOT NULL, ) PRIMARY KEY (col1): 第 6 行第 19 列的语法错误:解析时遇到“struct”:column_type

of course, removing the labels array of structs column works fine.当然,删除结构列的标签数组效果很好。

Correct.正确的。 In Spanner ARRAY of STRUCTs values can be constructed by SQL expressions, but are not supported as column types.在 Spanner ARRAY of STRUCT 中,值可以由 SQL 表达式构造,但不支持作为列类型。 See https://cloud.google.com/spanner/docs/data-types#declaring_an_array_type .请参阅https://cloud.google.com/spanner/docs/data-types#declaring_an_array_type

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 需要将 Spanner 数据库从一个 GCP 项目迁移到另一个 - Need to migrate Spanner db from one GCP Project to another 在 GCP Spanner 中,我可以设置表的大小限制吗? - In GCP Spanner, can I set a size limit of a table? 如何运行用 Golang 编写的 GCP Cloud Function 以运行数据流作业以将文本文件导入 Spanner? - How to run a GCP Cloud Function written in Golang to run a Dataflow job to import text file to Spanner? GCP 支持代理协议 V2 - GCP support proxy protocol V2 GCP SPANNER:对于时间戳数据类型,除了 allow_commit_timestamp=true 之外,可以在表中的列上设置哪些选项 - GCP SPANNER: What options can be set on a column in table other than allow_commit_timestamp=true for timestamp datatype Gcp支持从firebase绑定服务账号? - Gcp support binding service account from firebase? GCP 会在 2023 年 10 月之后支持 Mysql 5.7 吗? - Will GCP Support Mysql 5.7 beyond October 2023? 数据存储模式下的 gcp firestore 是否支持 OR 查询? - Does gcp firestore in datastore mode support OR query? BigQuery 结构数组,展平为一行 - BigQuery array of structs, flatten into one row 在 bigquery 中添加/访问结构数组的索引 - Add/access the index of the array of structs in bigquery
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM