将Firebase备份数据加载到BigQuery中

时间:2017-08-24 01:00:26

标签: android json firebase google-bigquery

我正在尝试将来自Firebase的以下JSON Collection从我的麻将游戏加载到BigQuery进行分析。这个游戏每天大约有30K游戏,我想对游戏结果做一些分析。即确定球员的表现如何,并提供有关打麻将的策略的建议。

JSON Collection如下所示:

- app-id-9999999999
  - games
    - GamerID: TallDingo31118 
      - GameDateTimeStamp: 170731065722722
          discardPlayer: 3
          handle: "TallDingo31118"
          level: 6
          roundNo: 12
          selfDrawn: false
          winningAmount: 288
          winningLevel: 10
          winningPlayer: 0
          winningTiles: "C1C1C1C2C2C2GDGDGDC3C3NWNWNW"

生成的JSON备份如下所示:

{"games":
 {"000177811614":
  {"170731065722722":
{"concealed":false,"discardPlayer":3,"level":6,"roundNo":0,"selfDrawn":false,"winningAmount":288,"winningLevel":10,"winningPlayer":1,
 "winningTiles":"C1C1C1C2C2C2GDGDGDC3C3NWNWNW"}},...

我在Firebase中使用此文档后的自动备份功能: https://firebase.google.com/docs/database/android/backups

我使用此文档在BigQuery中使用JSON加载功能: https://cloud.google.com/bigquery/loading-data#loading_json_files

生成加载作业时,我遇到以下错误:

Errors:
2017-08-10T02:05:48Z_app-id-999999999.json.gz: Failed to parse JSON: Closing quote expected in string; Could not parse value; Could not parse value; Could not parse value (error code: invalid)
Job ID  app-id-99999999: bquijob_999999_999999999
Creation Time   Aug 15, 2017, 7:18:18 PM
Start Time  Aug 15, 2017, 7:18:19 PM
End Time    Aug 15, 2017, 7:18:36 PM
Destination Table   app-id-99999999999:MahjongGames.Games
Write Preference    Write if empty
Source Format   JSON (Newline Delimited)
Source URI  gs://app-id-999999999-backups/2017-08-10T02:05:48Z-app-id-99999999999_data.json.gz (Open in GCS)
Autodetect Schema   true

在我看来,Firebase提供的JSON格式与BigQuery JSON解析器不兼容。

我曾尝试发布BigQuery的错误,但他们将我推荐给Firebase团队,他们说它应该可以工作并指出我已经遵循的文档,但是没有成功。

这是Firebase的广告功能,应该可以开箱即用。有人有这个工作吗?

0 个答案:

没有答案