Skip to content

Commit 44a3d49

Browse files
max-ostapenkoGCP Dataform
authored andcommitted
update to sql cells
1 parent 895a5c0 commit 44a3d49

1 file changed

Lines changed: 78 additions & 58 deletions

File tree

workspace/restore_data.ipynb

Lines changed: 78 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,80 @@
11
{
2-
"cells": [
3-
{
4-
"cell_type": "code",
5-
"execution_count": null,
6-
"id": "071bb978",
7-
"metadata": {},
8-
"outputs": [],
9-
"source": [
10-
"## [Restore deleted dataset](https://docs.cloud.google.com/bigquery/docs/restore-deleted-datasets#restore_a_dataset)\n",
11-
"UNDROP SCHEMA httparchive.crawl;"
12-
]
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"source": [
6+
"# sql_engine: bigquery\n",
7+
"# output_variable: df\n",
8+
"# start _sql\n",
9+
"_sql = \"\"\"\n",
10+
"## [Restore deleted dataset](https://docs.cloud.google.com/bigquery/docs/restore-deleted-datasets#restore_a_dataset)\n",
11+
"UNDROP SCHEMA httparchive.crawl;\n",
12+
"\"\"\" # end _sql\n",
13+
"from google.colab.sql import bigquery as _bqsqlcell\n",
14+
"df = _bqsqlcell.run(_sql)\n",
15+
"df"
16+
],
17+
"metadata": {
18+
"colab_type": "sql",
19+
"id": "XKFLLrG_ZlzC"
20+
},
21+
"id": "XKFLLrG_ZlzC",
22+
"execution_count": null,
23+
"outputs": []
24+
},
25+
{
26+
"cell_type": "code",
27+
"execution_count": null,
28+
"id": "fe7ae694",
29+
"metadata": {
30+
"id": "fe7ae694"
31+
},
32+
"outputs": [],
33+
"source": [
34+
"## [Restore deleted table](https://docs.cloud.google.com/bigquery/docs/restore-deleted-tables#restore_a_table)\n",
35+
"!date -d '2025-08-04 16:00:00.000000Z' +%s000\n",
36+
"!bq cp httparchive.crawl.pages@1759670400000 httparchive.crawl_staging.pages_backup_20250804"
37+
]
38+
},
39+
{
40+
"cell_type": "code",
41+
"source": [
42+
"# sql_engine: bigquery\n",
43+
"# output_variable: df\n",
44+
"# start _sql\n",
45+
"_sql = \"\"\"\n",
46+
"## [Restore a table to a specific point in time](https://cloud.google.com/bigquery/docs/restore-tables#restoring_a_table_to_a_specific_point_in_time)\n",
47+
"SELECT *\n",
48+
"FROM httparchive.crawl.pages\n",
49+
" FOR SYSTEM_TIME AS OF TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR);\n",
50+
"\"\"\" # end _sql\n",
51+
"from google.colab.sql import bigquery as _bqsqlcell\n",
52+
"df = _bqsqlcell.run(_sql)\n",
53+
"df"
54+
],
55+
"metadata": {
56+
"colab_type": "sql",
57+
"id": "o4REpWzuZr03"
58+
},
59+
"id": "o4REpWzuZr03",
60+
"execution_count": null,
61+
"outputs": []
62+
}
63+
],
64+
"metadata": {
65+
"kernelspec": {
66+
"display_name": "Python 3",
67+
"language": "python",
68+
"name": "python3"
69+
},
70+
"language_info": {
71+
"name": "python",
72+
"version": "3.12.8"
73+
},
74+
"colab": {
75+
"provenance": []
76+
}
1377
},
14-
{
15-
"cell_type": "markdown",
16-
"id": "1f18b3e6",
17-
"metadata": {},
18-
"source": [
19-
"## [Restore deleted table](https://docs.cloud.google.com/bigquery/docs/restore-deleted-tables#restore_a_table)\n",
20-
"!date -d '2025-08-04 16:00:00.000000Z' +%s000"
21-
]
22-
},
23-
{
24-
"cell_type": "code",
25-
"execution_count": null,
26-
"id": "fe7ae694",
27-
"metadata": {},
28-
"outputs": [],
29-
"source": [
30-
"!bq cp httparchive.crawl.pages@1759670400000 httparchive.crawl_staging.pages_backup_20250804"
31-
]
32-
},
33-
{
34-
"cell_type": "code",
35-
"execution_count": null,
36-
"id": "7edfdae5",
37-
"metadata": {},
38-
"outputs": [],
39-
"source": [
40-
"## [Restore a table to a specific point in time](https://cloud.google.com/bigquery/docs/restore-tables#restoring_a_table_to_a_specific_point_in_time)\n",
41-
"SELECT *\n",
42-
"FROM httparchive.crawl.pages\n",
43-
" FOR SYSTEM_TIME AS OF TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR);"
44-
]
45-
}
46-
],
47-
"metadata": {
48-
"kernelspec": {
49-
"display_name": "Python 3",
50-
"language": "python",
51-
"name": "python3"
52-
},
53-
"language_info": {
54-
"name": "python",
55-
"version": "3.12.8"
56-
}
57-
},
58-
"nbformat": 4,
59-
"nbformat_minor": 5
60-
}
78+
"nbformat": 4,
79+
"nbformat_minor": 5
80+
}

0 commit comments

Comments
 (0)