【问题标题】:What is the equivalent of binary(8) and varbinary(16) of MySQL in BigQuery?BigQuery 中 MySQL 的 binary(8) 和 varbinary(16) 的等价物是什么?
【发布时间】:2019-02-28 13:03:01
【问题描述】:

我正在从具有类型列的 MySQL 表中移动数据:

binary(8) 
varbinary(16) 

而且我在 BigQuery 文档中找不到等效类型 https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types

什么是等效类型?我需要知道在 BigQuery 中创建表时选择什么

【问题讨论】:

  • 很确定它是 BYTES 数据类型“BYTES 版本对 原始字节 而不是 Unicode 字符进行操作。STRING 和 BYTES 之间的强制转换强制使用 UTF-8 对字节进行编码。”
  • @RaymondNijland 如果我选择 BYTES 它是无限的?所以 binary(8) 和 varbinary(16) 之间没有区别?

标签: mysql google-bigquery


【解决方案1】:

BigQuery 只是提供了一个可变长度的 BYTES 类型。要编写字节文字,请在字符串前面加上 b,例如

SELECT b'\x10\x33';

您可以在data types documentation 中阅读更多信息。请注意,BigQuery 界面以 base64 格式显示 BYTES 值。

【讨论】:

  • 你需要使用BYTES
猜你喜欢
  • 1970-01-01
  • 2013-11-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-10-20
  • 1970-01-01
  • 2023-03-04
  • 2022-08-16
相关资源
最近更新 更多