Skip to content

Commit 84414cf

Browse files
Merge branch 'main' into deprecate_cwv_looker
2 parents 44d2306 + 0494218 commit 84414cf

5 files changed

Lines changed: 58 additions & 22 deletions

File tree

.github/linters/.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
extend-ignore = E501

.github/linters/.sqlfluff

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[sqlfluff]
2+
dialect = bigquery
3+
max_line_length = 200
4+
5+
[sqlfluff:indentation]
6+
indent_unit = space
7+
tab_space_size = 2
8+
indented_using_on = False
9+
allow_implicit_indents = True
10+
11+
[sqlfluff:layout:type:binary_operator]
12+
line_position = trailing
13+
14+
[sqlfluff:rules:capitalisation.keywords]
15+
capitalisation_policy = upper
16+
17+
[sqlfluff:rules:capitalisation.types]
18+
extended_capitalisation_policy = upper
19+
20+
[sqlfluff:rules:convention.count_rows]
21+
prefer_count_0 = True
22+
23+
[sqlfluff:rules:convention.quoted_literals]
24+
preferred_quoted_literal_style = single_quotes

infra/bigquery-export/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

workspace/project_options.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
SELECT * FROM `httparchive.region-us.INFORMATION_SCHEMA.EFFECTIVE_PROJECT_OPTIONS`;
1+
SELECT
2+
project_id,
3+
option_name,
4+
option_value,
5+
option_type
6+
7+
FROM `httparchive.region-us.INFORMATION_SCHEMA.EFFECTIVE_PROJECT_OPTIONS`;
28

39
ALTER PROJECT httparchive SET OPTIONS (
410
`region-us.default_sql_dialect_option` = 'only_google_sql',

workspace/restore_data.ipynb

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "e6f1073c",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"\"\"\"Utilities for restoring deleted BigQuery datasets and tables.\"\"\"\n",
11+
"from google.cloud import bigquery\n",
12+
"\n",
13+
"client = bigquery.Client()\n"
14+
]
15+
},
316
{
417
"cell_type": "code",
518
"execution_count": null,
@@ -10,16 +23,11 @@
1023
},
1124
"outputs": [],
1225
"source": [
13-
"# sql_engine: bigquery\n",
14-
"# output_variable: df\n",
15-
"# start _sql\n",
16-
"_sql = \"\"\"\n",
26+
"QUERY = \"\"\"\n",
1727
"## [Restore deleted dataset](https://docs.cloud.google.com/bigquery/docs/restore-deleted-datasets#restore_a_dataset)\n",
1828
"UNDROP SCHEMA httparchive.crawl;\n",
19-
"\"\"\" # end _sql\n",
20-
"from google.colab.sql import bigquery as _bqsqlcell\n",
21-
"df = _bqsqlcell.run(_sql)\n",
22-
"df"
29+
"\"\"\"\n",
30+
"client.query(QUERY).result()"
2331
]
2432
},
2533
{
@@ -31,9 +39,10 @@
3139
},
3240
"outputs": [],
3341
"source": [
34-
"## [Restore deleted table](https://docs.cloud.google.com/bigquery/docs/restore-deleted-tables#restore_a_table)\n",
42+
"# [Restore deleted table]\n",
43+
"# https://docs.cloud.google.com/bigquery/docs/restore-deleted-tables#restore_a_table\n",
3544
"!date -d '2025-08-04 16:00:00.000000Z' +%s000\n",
36-
"!bq cp httparchive.crawl.pages@1759670400000 httparchive.crawl_staging.pages_restored_20250804"
45+
"!bq cp httparchive.crawl.pages@1759670400000 httparchive.crawl_staging.pages_restored_20250804\n"
3746
]
3847
},
3948
{
@@ -46,19 +55,14 @@
4655
},
4756
"outputs": [],
4857
"source": [
49-
"# sql_engine: bigquery\n",
50-
"# output_variable: df\n",
51-
"# start _sql\n",
52-
"_sql = \"\"\"\n",
58+
"QUERY = \"\"\"\n",
5359
"## [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",
5460
"CREATE TABLE httparchive.crawl_staging.pages_restored_20250804 AS\n",
5561
"SELECT *\n",
5662
"FROM httparchive.crawl.pages\n",
5763
" FOR SYSTEM_TIME AS OF TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR);\n",
58-
"\"\"\" # end _sql\n",
59-
"from google.colab.sql import bigquery as _bqsqlcell\n",
60-
"df = _bqsqlcell.run(_sql)\n",
61-
"df"
64+
"\"\"\"\n",
65+
"client.query(QUERY).result()"
6266
]
6367
}
6468
],

0 commit comments

Comments
 (0)