Skip to content

get_view_history

get_view_history(fully_qualified_view)

Description

Get BigQuery View history

Usage

Call or Deploy get_view_history ?
Call get_view_history directly

The easiest way to use bigfunctions

  • get_view_history function is deployed in 39 public datasets for all of the 39 BigQuery regions.
  • It can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
  • (You need to use the dataset in the same region as your datasets otherwise you may have a function not found error)

Public BigFunctions Datasets

Region Dataset
eu bigfunctions.eu
us bigfunctions.us
europe-west1 bigfunctions.europe_west1
asia-east1 bigfunctions.asia_east1
... ...
Deploy get_view_history in your project

Why deploy?

  • You may prefer to deploy get_view_history in your own project to build and manage your own catalog of functions.
  • This is particularly useful if you want to create private functions (for example calling your internal APIs).
  • Get started by reading the framework page

Deployment

get_view_history function can be deployed with:

pip install bigfunctions
bigfun get get_view_history
bigfun deploy get_view_history

Examples

call bigfunctions.eu.get_view_history("your_project.your_dataset.view_name");
call bigfunctions.us.get_view_history("your_project.your_dataset.view_name");
call bigfunctions.europe_west1.get_view_history("your_project.your_dataset.view_name");

Use cases

A use case for the get_view_history function is tracking changes and debugging issues with a view's definition.

Imagine a complex view used in several dashboards and reports. Suddenly, the reports start showing unexpected results. Using get_view_history, you can quickly:

  1. Identify when the view definition changed: Retrieve the historical definitions of the view to pinpoint the exact time a modification was made that might have introduced the error.
  2. Compare different versions: Analyze the differences between previous versions and the current definition to understand exactly what changed in the SQL query. This helps in identifying the root cause of the issue.
  3. Revert to a previous version: If a problematic change is identified, having access to the historical definitions makes it easy to revert the view to a known good state while a fix is being developed.
  4. Audit view changes: Track who made changes and when, enhancing accountability and control over critical data assets. This is particularly important for regulatory compliance and data governance.
  5. Understand the evolution of a view: By examining the history, you can gain insights into how the view's logic has evolved over time, aiding in documentation and knowledge transfer.

Example: Let's say your view my_project.my_dataset.important_sales_view is producing incorrect totals. You suspect a recent change to the view's SQL is responsible. You could use get_view_history (assuming your project is in the US multi-region):

SELECT * FROM bigfunctions.us.get_view_history('my_project.my_dataset.important_sales_view');

This would return a table showing the different versions of the view's definition along with timestamps, allowing you to compare the SQL before and after the problem started occurring. This helps isolate the problematic change and restore a correct version quickly.


Need help or Found a bug?
Get help using get_view_history

The community can help! Engage the conversation on Slack

We also provide professional suppport.

Report a bug about get_view_history

If the function does not work as expected, please

  • report a bug so that it can be improved.
  • or open the discussion with the community on Slack.

We also provide professional suppport.


Show your ❤ by adding a ⭐ on