简体   繁体   English

将 Firebase 导出到 Bigquery 数据集的生存时间

[英]Export Firebase to Bigquery dataset time to live

Update: I found a solution for my first question meaning changing to never expires:更新:我为我的第一个问题找到了一个解决方案,意思是更改为永不过期:

I applied this code to my dataset and the firesbase console now showing never expires我将此代码应用于我的数据集,firesbase 控制台现在显示永不过期

bq update --default_partition_expiration 0 myotherproject:mydataset

在此处输入图像描述

But there is still the second question which is how to retrieve back the data that got expired because the default option was to keep only the last 60 days.但是还有第二个问题,即如何找回过期的数据,因为默认选项是只保留最后 60 天。 ( before someone ask , yes I did start the export and the table was available 3 month ago , it's not a problem of activating the functionality but more a problem that the table expired as we can see on my first screenshot it was written 170 days of expired data , I wonder how to get them back ) (在有人问之前,是的,我确实开始导出并且表格在 3 个月前可用,这不是激活功能的问题,而是表格过期的问题,正如我们在我的第一个屏幕截图中看到的那样,它是 170 天的过期数据,不知道怎么找回)

End of update更新结束

I have activated the export from firebase to google bigquery but the time to live is block at 60 days even though I am using the blaze plan cf screenshot :我已经激活了从 firebase 到 google bigquery 的导出,但是即使我正在使用 blaze plan cf screenshot,存活时间也被阻止在 60 天:

在此处输入图像描述

Is there a way to change the dataset to live to never expire as I am losing my historical data.有没有办法将数据集更改为永不过期,因为我正在丢失我的历史数据。 Note that i was able to have that by default some time back on another project that looked like this but I cannot find any feature to change it on firebase console请注意,默认情况下,我可以在另一个看起来像这样的项目上使用它,但我在 firebase 控制台上找不到任何功能来更改它

Note that I have also change the expiry time on data retention in GA4F to 14 month but it doesn't change anything请注意,我还将 GA4F 中数据保留的到期时间更改为 14 个月,但它没有任何改变

在此处输入图像描述

If you are not on a paid plan, then the retention of Google Analytics data in BigQuery is set permanently to 60 days.如果您未使用付费计划,则 BigQuery 中 Google Analytics(分析)数据的保留期限将永久设置为 60 天。

If you are on a paid plan, then tables created after you set the TTL will observe the setting.如果您使用的是付费计划,那么在您设置 TTL 后创建的表将遵循该设置。

For pre-existing tables you can generate commands to update them with a query like the following:对于预先存在的表,您可以生成命令以使用如下查询更新它们:

SELECT CONCAT("ALTER TABLE `<PROJECT_ID>.analytics_<PROPERTY_NUM>.", table_id, "` SET OPTIONS (expiration_timestamp=NULL);") AS cmd
FROM `<PROJECT_ID>.analytics_<PROPERTY_NUM>.__TABLES_SUMMARY__`
WHERE table_id LIKE 'events_2021%'

As mentioned in comments, you can also update partitions from the gcloud CLI with a command similar to this:如评论中所述,您还可以使用类似以下的命令从 gcloud CLI 更新分区:

bq update --default_partition_expiration 0 projectid:datasetname

I faced the same issue and here's the complete step to change "Dataset time to live" to "Does not expire".我遇到了同样的问题,这是将“数据集生存时间”更改为“不会过期”的完整步骤。 Before going into the solution, please be aware that the analytics data in BigQuery is structured as below.在进入解决方案之前,请注意 BigQuery 中的分析数据结构如下。

Project项目

→ Dataset (eg analytics_<PROPERTY_NUM>) → 数据集(例如 analytics_<PROPERTY_NUM>)

→→ Partitioned Table (eg event_) →→ 分区表(例如 event_)

Step1.步骤1。 Update the Dataset's default table expiration更新数据集的默认表过期时间

The official doc is here: https://cloud.google.com/bigquery/docs/updating-datasets#table-expiration官方文档在这里: https ://cloud.google.com/bigquery/docs/updating-datasets#table-expiration

You can run the below command or update from the GCP console.您可以运行以下命令或从 GCP 控制台更新。

When using GCP console, make sure to open the "Dataset Details" by clicking 3 dots right to the dataset name.使用 GCP 控制台时,请确保通过单击数据集名称右侧的 3 个点来打开“数据集详细信息”。 If you click table (eg events_(60)), that will open the individual partitioned table setting and you cannot update the dataset property!!如果您单击表(例如 events_(60)),这将打开单个分区表设置并且您无法更新数据集属性!

bq update --default_table_expiration 0 <PROJECT ID>:analytics_<PROPERTY_NUM>

Step 2. Update the Dataset's default partition expiration time步骤 2. 更新 Dataset 的默认分区过期时间

The official doc is here: https://cloud.google.com/bigquery/docs/updating-datasets#partition-expiration官方文档在这里: https ://cloud.google.com/bigquery/docs/updating-datasets#partition-expiration

You can run below command.您可以运行以下命令。 This cannot be done in GCP Console.这无法在 GCP Console 中完成。

bq update --default_partition_expiration 0 <PROJECT ID>:analytics_<PROPERTY_NUM>

Step 3. Update the existing Partitioned Table's expiration time步骤 3. 更新现有 Partitioned Table 的过期时间

You can use the command answered in https://stackoverflow.com/a/68353669/18035137 by Kato.您可以使用 Kato 在https://stackoverflow.com/a/68353669/18035137中回答的命令。

SELECT CONCAT("ALTER TABLE `<PROJECT_ID>.analytics_<PROPERTY_NUM>.", table_id, "` SET OPTIONS (expiration_timestamp=NULL);") AS cmd
FROM `<PROJECT_ID>.analytics_<PROPERTY_NUM>.__TABLES_SUMMARY__`
WHERE table_id LIKE 'events_2021%'

Once you finish the above 3 steps, you can check Firebase project setting and the "Dataset time to live" is immediately changed to "Does not expire".完成上述 3 个步骤后,您可以检查 Firebase 项目设置,“Dataset time to live”立即更改为“Does not expire”。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM