Can external JavaScript libraries be utilized within BigQuery functions?

I'm new to user-defined UDFs, so please bear with me if this question seems basic.

Is it possible to use a standard http library to make a request FROM a BigQuery function?

Essentially, I want to create a function that can be accessed from SQL and will trigger an external service via http.

I've attempted to import and require the http library in my custom function, but both have failed when running the Javascript in BigQuery.

'use strict';

function https(){
    let res = '';
    http = require('http');
    http.get('https://google.com'), (resp) => {
      let data = "";
      resp.on('end', () => {
        res = "pinged";
      });
    };

    return res;
};

Thank you in advance!

Answer №1

Elliott Brossard pointed out that the task is simply not feasible.

The approach I ultimately decided on involved creating a collection of UDF Javascript functions and utilizing another separate Javascript library to interact with this code. This secondary library was responsible for managing all web-related operations.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Retrieving the initial entry from a JavaScript ES2015 Map

I am working with a Map structured as follows: const m = new Map(); m.set('key1', {}) . m.set('keyN' {}) The Map may contain one or multiple items. I am wondering if there is a way to retrieve the first item by index, without using m. ...

Tips on sending a form to the server with ajax technology

I'm struggling with sending a button id to my server through ajax in order to submit a form without having to constantly reload the page every time I click on a button. Unfortunately, it's not working as expected and I can't figure out why. ...

Add the schema-form to the app.module for importing

I've been attempting to incorporate the angular-schema-form into my angular project, but I'm facing issues with importing it in my app.module.ts file. Here is my current configuration: app.module.ts import { BrowserModule } from '@angular/ ...

Tips for altering the appearance of a header when clicked on?

I am trying to change the internal style sheet in the "style" head when a user clicks, without using inline styles. I have successfully added new CSS for divone as text, but I can't seem to delete the old one (element.classList.remove("#divone");). Is ...

Best Practices for Making Remote Requests in Ruby on Rails

Currently, I am creating a Single Page Application using Ruby on Rails for the first time. Although I am still learning, I have set up a side menu with links and a container on the right part of the page to display partial pages. An example of one of my me ...

Changing the Size of React Bootstrap Cards to Fit Your Grid Layout with Custom CSS

I am facing an issue with the varying sizes of react-bootstrap cards within a grid display. Check out the problem I am encountering: https://i.sstatic.net/szHjI.png I need the size of Over Under 0.5 card to be different from the one for Match Winner, as ...

Tips for displaying icons in a row when hovering my mouse

I'm trying to incorporate feather icons into my project, specifically the trash icon to appear next to the item name when I hover over it. I found someone else asking a similar question on Stacks, but unfortunately, they didn't receive an answer ...

Tips for transferring the clicked value to the next page

Recently, I started working with Ionic and developed an application using it. Now, I am facing a challenge where I need to pass the value from the first page to the second page. To illustrate this more clearly, I have attached two photos. Here is the imag ...

Problem related to permissions within a node.js package

Introducing my newly built npm module called emeraldfw, now available for public use. Here is a glimpse of the contents in my package.json file: { "name": "emeraldfw", "version": "0.6.0", "bin": "./emeraldfw.js", "description": "Emerald Framework ...

Issue encountered when attempting to store a nickname in the MySQL database

I am currently working with the Steam API and I have encountered an issue when trying to save user nicknames to the database. The problem occurs when the nickname contains Russian words or special symbols such as ʊ ϟ ღ 回 ₪. The database is set up ...

In an effort to organize a roster of student roll numbers for the class, I am utilizing a JavaScript function to generate and update an array with the most recent entries

Greetings! I am looking to enhance the functionality of my webpage by allowing users to input the name and roll number of a new student. Once submitted, I want to add this student to an existing list using Javascript functions, for loops, and arrays, and d ...

What is preventing me from dynamically generating a property?

As someone who is new to TypeScript, I have a question regarding defining properties. In JavaScript, we can define a property dynamically like this: class Rectangle { constructor(height, width) { this.height = height; this.width = width; } } ...

Finding documents that are not mentioned in a document from a separate collection

I am facing a challenge with two MongoDB models called session and unreadcount. Specifically, I need to retrieve the count of a particular session from another table. The structures of my models are as follows: var UnreadCountSchema = new mongoose.Schema({ ...

What is the process for importing the required dependencies for the maps module in react-svg-map?

Exploring interactive maps led me to discover the project react-svg-map. As I followed the example provided, a certain issue caught my attention: import Taiwan from "@svg-maps/taiwan"; The developers mentioned that they have separated the map&ap ...

Enhancing Graphics with Anti Aliasing in Three.js and WebGL

While spinning my model with an orbiter, I am experiencing some issues with anti-aliasing. Currently, I am using the following renderer: renderer = new THREE.WebGLRenderer({ preserveDrawingBuffer: true, antialias: true }) ...

What is the best way to monitor different selections to keep track of their state?

In a certain scenario, a user is presented with three options: They can select the body_type of a car, the car_year it was manufactured, or the car_make. Initially, there is a state called carJson which contains a list of cars. "2": { " ...

Presenting a ui-router modal while maintaining the parent state's refresh-free appearance

I have implemented a unique feature in my angular app called modalStateProvider. It allows me to easily have modals with their own URLs. // Implementing the modalStateProvider app.provider('modalState', [ '$stateProvider', function ...

Adjust the attributes of THREE.tubeGeometry

Within my Three.js scene, I currently have a tube object that I need to dynamically adjust the start and end points of. I believe this approach is more efficient than creating a new tube with updated points and removing the old one. If this is not the case ...

Is it possible to submit two forms simultaneously using jQuery or AJAX?

My plan is to save 2 forms, with the first form providing the Foreign key for the second form. This is my attempt at saving this using JavaScript: $("#btnSave").click(function (e) { e.preventDefault(); $('#workForm').submit(); ...

Erroneous spread transformation in Babel

A question regarding the incorrect conversion/transpiling of code by Babel: const arr = [...new Set([1, 2, 3, 1])] This is being converted into: var arr = [].concat(new Set([1, 2, 3, 1])) The original code returns a list of numbers, while the transformed ...