Google Spanner
非官方测试版翻译
本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →
安装
npm install @google-cloud/spanner
数据源选项
通用数据源选项请参见数据源选项。
通过设置环境变量 GOOGLE_APPLICATION_CREDENTIALS 为应用程序代码提供身份验证凭据:
# Linux/macOS
export GOOGLE_APPLICATION_CREDENTIALS="KEY_PATH"
# Windows
set GOOGLE_APPLICATION_CREDENTIALS=KEY_PATH
# Replace KEY_PATH with the path of the JSON file that contains your service account key.
要在模拟器中使用 Spanner,需设置 SPANNER_EMULATOR_HOST 环境变量:
# Linux/macOS
export SPANNER_EMULATOR_HOST=localhost:9010
# Windows
set SPANNER_EMULATOR_HOST=localhost:9010
列类型
bool, int64, float64, numeric, string, json, bytes, date, timestamp, array