[MDEV-16418] CONNECT Engine - Feature Request: Remote Script Execution Created: 2018-06-07 Updated: 2018-06-09 Resolved: 2018-06-09 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Minor |
| Reporter: | Juan Telleria | Assignee: | Olivier Bertrand |
| Resolution: | Won't Do | Votes: | 0 |
| Labels: | 10.4.1 | ||
| Issue Links: |
|
||||||||
| Description |
1. ObjectiveTo give the possibility to call the execution of external: Scripts directly from MariaDB, just as SQL Server, from 2017 Edition onward, allows to do so:
And PostgreSQL so does for Python: The ultimate objetive is, for example, to trigger the execution of a remote Python/R Code for updating a predictive model in keras/h2o/tensorflow/... when new data is introduced into the database, or as part of a SQL procedure. 2. OPTION A: Through a Table2.1 ImplementationOne possible implementation could be as follows: 2.1.1. Enable External Script Execution: my.ini
2.1.2. Script Repository Creation: CREATE TABLEFor using the "CONNECT REMOTE_TABLE" Engine, the user will have to create an empty table as follows:
2.1.3. Call a Script: SELECTThere will be 3 main ways of calling a R / Python Script from MariaDB: A. To Import an R / Python Script on the fly an call it from MariaDB Server:
B. To write a Script directly in the IDE and call it from MariaDB Server:
C. To call a previously saved R / Python Script into tbl_name:
2.2 InternalsConnect will:
An example R Script to execute in the RScript.exe, which makes use of an ODBC Connection, would be:
2.3. Security IssuesThis new feature could imply security issues, so:
Also another solution would be to have to force the users to store the Python and R .exe directly in the MariaDB installation folders, so that greater care of such executable files can be taken in the system. 3. OPTION B: Through a Stored ProcedureThis new feature could imply security issues, so:
Also another solution would be to have to force the users to store the Python and R .exe directly in the MariaDB installation folders, so that greater care of such executable files can be taken in the system. 4. CollaborationI could ask the maintainer of the R "RMariaDB" package (Developed in C++ and R) in case he would be interested in collaborate in this project. |
| Comments |
| Comment by Olivier Bertrand [ 2018-06-07 ] |
|
To: Juan Actually, I am not sure I understand what you're doing. When creating a table, in all DBMSs, the column specifications describe the returned result. This is what SQL Server does. So would all specifications of the script to execute be contained in options, not in columns? |
| Comment by Olivier Bertrand [ 2018-06-08 ] |
|
As I previously said, in a create table, columns definition is meant to describe the returned result and cannot be used for other purpose. |
| Comment by Juan Telleria [ 2018-06-09 ] |
Done.
CONNECT would also need the language to be specified: 'R' or 'Python'
In my example, I've moved to my.ini options some configuration settings for greater sequrity.
In SQL Server, it is possible to return a Pandas DataFrame, and in R a data.frame, a tibble, and a data.table I guess. Also, it would be nice to return an empty table only with warnings / errors / etc. for remote execution without retrieving any results.
It is also a concern for me, how does SQL Server solve it?
We could request collaboration for R maybe to Kirill Müller, creator of package RMariaDB (https://cran.r-project.org/web/packages/RMariaDB/index.html), maybe he will be open for collaboration, or at least, give some advice. Thank you |
| Comment by Olivier Bertrand [ 2018-06-09 ] |
|
From your description, this looks like a new feature of MariaDB, as it is for SQL Server. However, why this would be implemented by a storage engine? This request should be directly addressed to MariaDB development. Unless there is something proving that only CONNECT can be used to implement it, I won't study how to add it to CONNECT, because it seems to be too a complicate thing to do, and mainly because CONNECT being now a GA product, adding this would regress it to a beta availability product. |
| Comment by Juan Telleria [ 2018-06-09 ] |
|
Maybe it shall have its own storage engine (Alpha), and for greater sequrity, this storage engine shall come with its own distribution of R / Python for greater safety. Mmmm... Thank you however, we at least tried |
| Comment by Juan Telleria [ 2018-06-09 ] |
Have opened a new issue: MDEV-16453 |
| Comment by Juan Telleria [ 2018-06-09 ] |
|
Do you know who in the MariaDB Development Team could reconsider this implementation with another focus? Could you re-assign the issue (if appropriate)? Thank you. |
| Comment by Olivier Bertrand [ 2018-06-09 ] |
|
Perhaps serg |