I'm using FUNCTION_CREATE to create FM and everything is working fine, I'm passing bunch of parameters and FM is created like it should. But the problem is the Source Code part of FM. Is it possible to create it with FUNCTION_CREATE and which parameter should I use?
Thanks
If you want to create function modules with the source code, then you need to use RS_FUNCTIONMODULE_INSERT as it has a source parameter.
Related
As illustrated here, dumping the wasm byte code and copy past into the javascript seems difficult.
I guess you mean a better way than copying into JS - I haven't investigated that (yet), but this will make UDFs easier for others to use:
Move the .js out of the query into a file.
Create a persistent function.
Then people will be able to call it like this:
SELECT fhoffa.x.sample_wasm_udf([2,3,4])
To create this function I did:
CREATE OR REPLACE FUNCTION fhoffa.x.sample_wasm_udf(x ARRAY<INT64>)
RETURNS ARRAY<INT64>
LANGUAGE js AS '''
return main(x)
'''
OPTIONS (library="gs://fh-bigquery/js/wasm.udf.js");
For more on persistent functions, see:
https://medium.com/#hoffa/new-in-bigquery-persistent-udfs-c9ea4100fd83
I'm trying to write a function module and I stuck with the step below.
Where can define "Associated type"? I define it in SE11 as Data type->Data Element and it didn't work, then I defined it as Data type->Table type, it didn't work again. Or it already defined somewhere else?
You can easily define table parameters under the tables tab. Why do not use it ? These parameters can be used import and export parameters as well.
Thanks.
I'm trying to build a Python Unit Test File Template in PyCharm. The overall result I want to achieve is:
A user creates a new file with my template, say "widget_builder.py"
Inside the template I want to create the class name by taking the file name "widget_builder" and turning it into "WidgetBuilderTests"
It looks like I need to use a Live Template to manipulate the file template variable $FILE_NAME$?
How can I create a Live Template that given a passed in variable (in this case $FILE_NAME$), applies both the underscoresToCamelCase and capitalize functions to it?
If I declare the Template text as:
$CLASS_NAME$
...and then edit variables, how can I reference a passed in variable of '$FILE_NAME$'?
I'd imagine it to look something like this, but I just can't get it to work:
I'm sure there must be a way to do this, but I just can't quite wrap my head round it.
Is this possible? Thanks!
EDIT
I've got a bit further. If I define the template as this:
If I then use it, this happens:
So the end result of $CLASS_NAME$ (WidgetBuilder) on the left is what I want, but I don't want $FILE_NAME$ (widget_builder) to be there once I hit return.
So your problem here is that $FILE_NAME$ is not a native variable in the live templates, merely an arbitrary name. What you actually want to be using is another function: fileNameWithoutExtension().
So your template would look something like:
I need to delete every single function from my project (VB.Net) and place them in separate DLLs. For example, i have a function that creates a text file and appends text to it. I need a solution that will load my AppendToTextFile.DLL with params just like a function works.
At this time my function accepts two parameters like
AppendToTextFile("C:\test\textFile.txt", "text to be appended")
Does anyone know how to load a custom DLL with params like the function above?
Create your custom DLL.
Then add it as reference to your project.
Call you function and use it like this :
Dim mydll As New MyCustomeDll
mydll.AppendToTextFile("C:\test\textFile.txt", "text to be appended")
That's all.
I'm learning SciLab and I need to figure out the equivalent from MATLAB for running user-defined functions.
I'm used to MATLAB, where when you type foo(27), it looks for the foo.m script in the current directory and then the MATLAB path, and if it finds one, it calls that function with argument 27.
What's the equivalent to SciLab? It doesn't seem to want to look in the current directory for the appropriate .sci file.
In Scilab, you need to explicitly load the script that contains the function. Assuming you've changed your directory to the directory where the function file is loaded, which can be done in Scilab using the menu buttons or the following command:
cd("path/to/working/directory")
Now you load the function file. Assuming the function foo is stored in a file called foo.sci, you need to load this script using the following command:
exec("foo.sci")
Now you should be able to use your function as you would be able in MATLAB.
foo(27)