How to view a User Defined Function in BigQuery

I wrote a User Defined function in BigQuery SQL and the documentation doesn't show how to view an existing function code. In other engines, the sintax is something like SHOW FUNCTION ... but that doesn't work here.

Thanks.

Upvotes: 1

Views: 1441

Answers (2)

Kyrylo Bulat
Kyrylo Bulat

Reputation: 800

You can try to use INFORMATION_SCHEMA views to view the source code and other parameters of the UDF:

  #standardSQL
  select * 
  from <project_id>.<dataset_name>.INFORMATION_SCHEMA.ROUTINES;

Pay attention to the location of your UDF, because INFROMATION_SCHEMA view results depend on the location of objects.

Upvotes: 2

Vibhor Gupta
Vibhor Gupta

Reputation: 709

You can create function as below :-

CREATE FUNCTION `project.dataset.Function`(x INT64) AS (x * 3);

Use of function will be as :-

select `project.dataset.Function` (Coll) from `project.dataset.Table`

To view function you need to click on function on dataset, you will get entire code.

Upvotes: 1

Related Questions