I'm trying to create a JS UDF from Python like so:
def create_js_udf(client, dataset):
client.create_routine(
bigquery.Routine(
f"{client.project}.{dataset}.{name}",
language="JavaScript",
type_="SCALAR_FUNCTION",
imported_libraries=["gs://some_bucket/turf.js"],
body="return true", # This is not the real body, as seen by error below this is not relevant
return_type=bigquery.StandardSqlDataType(type_kind=bigquery.StandardSqlTypeNames.BOOL),
),
exists_ok=True,
)
with bigquery.Client(
project=bigquery_project_id, client_options=client_options, credentials=AnonymousCredentials()
) as client:
client.create_dataset(f"test.test", exists_ok=True)
create_js_udf(client, "test")
yield client
The emulator is configured like this in compose.yaml:
What happened?
I'm trying to create a JS UDF from Python like so:
The emulator is configured like this in compose.yaml:
When running python code, I see the following log from the emulator:
I have inspected the code in the error and looks like JS UDFs are not supported: https://github.com/goccy/bigquery-emulator/blob/58f8350a496fa19d253610b494a05dd57b48e07e/internal/contentdata/repository.go#L487
What did you expect to happen?
I expected that JS UDFs would work as it's stated they work in the README.![image](https://github.com/user-attachments/assets/d700409b-0023-4b65-9bf1-6a680b4a8d7b)
How can we reproduce it (as minimally and precisely as possible)?
Use the snippets I provided above, or contact me for a full repro; I would gladly jump on a call.
Anything else we need to know?
No response