Skip to content

Commit 0c47c69

Browse files
author
paul.marcombes
committed
create_ga4_views function updated
1 parent 32f72d8 commit 0c47c69

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

bigfunctions/ga4/create_ga4_views.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ code: |
2020
create or replace temp table code as
2121
2222
with filepaths as (
23+
2324
select
2425
lax_string(file.path) as path,
2526
from unnest(
@@ -29,13 +30,13 @@ code: |
2930
)
3031
) as file
3132
where ends_with(lax_string(file.path), '.sql')
33+
3234
),
3335
3436
3537
files_content as (
3638
3739
select
38-
3940
regexp_replace(replace(replace(replace(
4041
lower(path),
4142
'/', '__'),
@@ -61,14 +62,19 @@ code: |
6162
'create or replace table function `%s`.%s(start_date string, end_date string) as',
6263
destination_dataset, name
6364
) ||
64-
replace(regexp_replace(regexp_replace(
65+
replace(replace(replace(replace(regexp_replace(regexp_replace(
6566
'\n' || content,
6667
'^DECLARE.*', ''),
6768
'\nDECLARE.*', ''),
68-
'project.dataset', ga4_dataset
69+
'project.dataset', ga4_dataset),
70+
'your-project-id.your-dataset-id', ga4_dataset),
71+
'your-project-id.dataset_name', ga4_dataset),
72+
'your-project-id.analytics_1234567890', ga4_dataset
6973
)
7074
) as code
7175
from files_content
76+
where not starts_with(name, 'bigquery_administration')
77+
order by name
7278
;
7379
7480

0 commit comments

Comments
 (0)