Get all loaded modules in DolphinDB - user-interface

How to check the loaded modules in DolphinDB? Or, which command can be used to access the modules executed in the GUI or the startup script (startup.dos)?

I use defs() to check loaded functions, and use this query to get whether your module is loaded:
select * from defs() where name like '<module_name>::%'

Related

Monetdbe Python UDF

Given that monetdbe is a Python package, I'm optimistic that Python user-defined-functions are possible, but I haven't been able to find an example. I've tried this:
drop function every_other_letter;
create function every_other_letter(s string)
returns string
language python {
letters = "".join(s[::2])
return letters
};
select every_other_letter('foobarbaz');
I get this error:
ParseException:SQLparser:42000!Internal error while compiling statement: TypeException:user.p2_1[4]:'pyapi3.eval' library error in: Embedded Python 3 has not been enabled. Start server with --set embedded_py=3
Is there any way to set these flags in the embedded version?
The LANGUAGE PYTHON UDF's are a nice development feature in MonetDB's server installation but this feature requires an additional Python module to be loaded. And there is currently no way to configure monetdbe to load the required python module.
However assuming you have performance requirement for some production setting that are not met with the out-of-the-box SQL toolset in monetdbe, it makes more sense to implement a custom UDF extension written in C/C++. In regular MonetDB's server installation, the database server mserver5 can load an arbitrary extension module using the --loadmodule=<module> command option. But there is no equivalent monetdbe_option as of yet.
You might consider adding a feature request for this on monetdbe-python's github repository.
However there seems to exist a functioning undocumented workaround for adding UDF extensions to monetdbe. During its initialization, monetdbe attempts to load a set of hard coded modules. One of those is a module named "udf". You can create your own implementation of this module and load it into monetdbe.
Creating a native UDF extension is outside of the scope of this question and answer but there exist a nice up-to-date tutorial for writing UDF extensions for MonetDB here. Following the steps described in that tutorial, you end up with a SQL function revstr which has a user defined native implementation. The following Python script demonstrate its use:
from monetdbe import connect
with connect(autocommit=True) as con:
cur = cur.execute("select revstr('abcde')")
result = cur.fetchall()
print(result)
Make sure that the library containing your UDF extension is in the search path of the dynamic linker:
LD_LIBRARY_PATH=<path to directory containing lib_udf> python test.py

How do I use ansibel-playbook to connect to mysql to execute SQL statements

I want to connect to mysql through ansible-playbook and execute SQL statements, but there is no relevant module in the official website of ansible. Does anyone know how to operate
When there does not exist an official module to do something, you basically have two choices:
Find a custom module that someone has written that will do it (such as this one).
Write a custom module that will do it.
Do it using the command module or any of the other arbitrary command modules.
In your case, for a one-off playbook, I would typically go with the third option as I don't much care for running custom modules. I would make sure (Via Ansible of course) that mysql was installed on the box you were running against, and build a mysql command line string based on what you need to do which you then run on a host with access to the DB server (or the DB server itself). That's the quickest and dirtiest method.

use of multiple custom scripts in metadata parameter of the LaunchInstanceDetails method in oci.core.model

I understand that the LaunchInstanceDetails method in oci.core.model has a parameter -> metadata , wherein one of the metadata key-names that can be used to provide information to Cloud-Init is -> “user_data” , which can be used to run custom scripts by Could-Init when provided in a base64-encoded format.
In my Python code to create a Windows VM,while launching the instance, I have a requirement to run 2 custom scripts:
Script to login to Windows machine via RDP – this is absolute(needs to be executed every time a new Windows VM is created without fail) – Currently , we have included this in the metadata parameter while launching the instance, as below:
instance_metadata['user_data'] = oci.util.file_content_as_launch_instance_user_data(path_init)
Bootstrap script to Install Chef during the initialization tasks - this is conditional ( this needs to run only if the user wishes to Install Chef and we internally handle it by means of a flag in the code) – Yet to be implemented as we need to identify if more than one custom script (conditional in this case) can be included.
Can someone help me understand if and how we can achieve to include multiple scripts(keeping in mind the conditional clause) in a single metadata variable or can we have multiple metadata or some other parameter in this service that could be utilised to run the Chef Installation script
I'd suggest combining these into a single script and using the conditional in a if statement to install Chef as required.

Permanently blacklist linux kernel module

I have pcspkr in blacklisted in /etc/modprobe.d/pcspkr.conf. However, I can manually load the module using modprobe.
I'm guessing, some other component will be able to do the same via module alias mechanism. Is there a way to permanently block automatic loading of a specific kernel module?
My use case is that I want to experiment with an alternative driver than the one provided in-tree. For this, I do not want the system's default driver showing up. I do not want to delete the golden driver provided by the kernel and screw up either.
What options do I have ?

Zope register external methods using zcml configure

Is it possible to register external methods for Zope using a configure.zcml file or something similar? I'm trying to register external Python scripts (similar to other registry items such as "jsregistry.xml" or "cssregistry.xml" in themes)
No. External Methods are "old tech", pre-dating the Zope Component Architecture by several years.
You can easily add a GenericSetup import step that creates ExternalMethod objects on demand, but since only python modules located in the Extensions directories (inside Products and the INSTANCE_HOME location, you may as well just enumerate those locations via the usual Python file-access methods, add everything you find there and not use a registry at all.
However, are you absolutely certain you want to use an ExternalMethod? Wouldn't a simple utility or view be easier?

Resources