Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BiqQuery views should be dynamically created #76

Open
thdk opened this issue Jun 27, 2019 · 1 comment
Open

BiqQuery views should be dynamically created #76

thdk opened this issue Jun 27, 2019 · 1 comment

Comments

@thdk
Copy link
Owner

thdk commented Jun 27, 2019

There should not be any manual step when deploying to a new environment.

Therefor it should be possible to create the big query views (timesheets_view and projects_view), that have been created using the bigquery UI, from code.

Documentation: https://cloud.google.com/bigquery/docs/views

"Call the tables.insert method with a table resource that contains a view property."

@thdk
Copy link
Owner Author

thdk commented Nov 23, 2020

with ranked as (
SELECT r.Id, r.time Time, r.project p1, r.userid, r.task t1, r.modified, r.description Description, r.date Date, r.deleted, r.client, r.divisionId, row_number() over (partition by r.id order by r.modified desc) rank
FROM `PROJECT.timesheets.registrations` r 
where r.date < current_timestamp() 
)

select r.Time, p.name Project, r.Description, r.date Date, u.name User, t.name Task, c.name Client, st.subteam Subteam, st.scrumteam Scrumteam, st.email Email, r.divisionId division from ranked r
left outer join `PROJECT.timesheets.projects_view` p
on r.p1 = p.id
left outer join `PROJECT.timesheets.users_view` u
on r.userid = u.id
left outer join `PROJECT.timesheets.tasks` t
on r.t1 = t.__key__.name
left outer join `PROJECT.timesheets.SubteamUser` st
on st.id = u.id
left outer join `PROJECT.timesheets.clients` c
on c.__key__.name = r.client
where r.rank = 1 
and (r.divisionId is null or r.divisionId = "")
and r.time is not null 
and (r.deleted is null or r.deleted = false)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant