1

Topic: Assembly CLR with UNSAFE

Assembly CLR with  UNSAFE creates new process (exterior, for example powershell.exe).
Whether there will be a created process is visible in  Windows tasks?
And if will be, that will be, if it to beat?

2

Re: Assembly CLR with UNSAFE

CLR;
It will be visible.
If beat anything critical will not be if you in the further logic do not have calls to a process copy. Otherwise catch an exception.

3

Re: Assembly CLR with UNSAFE

Thanks

4

Re: Assembly CLR with UNSAFE

CLR wrote:

Assembly CLR with  UNSAFE creates new process (exterior, for example powershell.exe).
Whether there will be a created process is visible in  Windows tasks?
And if will be, that will be, if it to beat?

It simply song:-D

5

Re: Assembly CLR with UNSAFE

Rolg Hupin;
So laws of physics do not forbid. Who is excited with ethics, principles and consequences?

6

Re: Assembly CLR with UNSAFE

And in essence is what to tell?

7

Re: Assembly CLR with UNSAFE

CLR;
It is in essence already told.
[spoiler] what for it easier is not clear to you surrendered "is through back pass"? [/spoiler]

8

Re: Assembly CLR with UNSAFE

felix_ff,
Well, I it not to you, I wanted to hear in essence from certain clever men, from which here favor 0.0000.
I understood that anything terrible will not be, but it would be desirable to understand, what problems can arise.
"What for?" Is a question more philosophical. If it is not dangerous to a sequel why and not to use such architecture. The purpose - to cause scripts on powershell from tsql which will return a line.

9

Re: Assembly CLR with UNSAFE

CLR;
Well and imagine that at you the powershell-script for example leaves in drowsiness (for any reason), and   its process waits from it for the answer.
Will wait while manually do not get on the server process to beat.
I it to what, doubtful enough pleasure of decentralization of operations.
If start of exterior applications on what that to the logician from a sequel is necessary for you, I on your place would look aside service broker with exterior activation.

10

Re: Assembly CLR with UNSAFE

[spoiler]
And by the way: potentially any assembly is harmful to the server with permission_set> SAFE
In the MSEC specially named UNSAFE:-D - what if that all cones to you
[/spoiler]

11

Re: Assembly CLR with UNSAFE

CLR;
If at you 2016 sequel, it is possible to fulfill scripts on R (through sp_execute_external_script). In 2017 version it is added python. MS very much advanced this method for execution of scripts.

12

Re: Assembly CLR with UNSAFE

[spoiler] the Class smile Somebody dashes against the rock, to it speak - do not do so, it will be bad. And he answers - speak to the point, I punch a head a wall.
[/spoiler]

13

Re: Assembly CLR with UNSAFE

Vladislav Kolosov;
At you arguments are? Or on a word to you it is necessary to trust me?

14

Re: Assembly CLR with UNSAFE

felix_ff wrote:

CLR;
Well and imagine that at you the powershell-script for example leaves in drowsiness (for any reason), and   its process waits from it for the answer.
Will wait while manually do not get on the server process to beat.
I it to what, doubtful enough pleasure of decentralization of operations.
If start of exterior applications on what that to the logician from a sequel is necessary for you, I on your place would look aside service broker with exterior activation.

If hangs up - yes, it agree, it is a minus. But me the moment of survivability of a sequel more interested not to drop a sequel.
With service broker the interesting variant, but is necessary to me the synchronous call, for example I want to receive result from a Web server, for example json.

15

Re: Assembly CLR with UNSAFE

cossack5 wrote:

CLR;
If at you 2016 sequel, it is possible to fulfill scripts on R (through sp_execute_external_script). In 2017 version it is added python. MS very much advanced this method for execution of scripts.

Here it is interesting, thanks!

16

Re: Assembly CLR with UNSAFE

CLR;
To read lectures the reluctance, but understand, when it is required to retain all it afloat at least at semiindustrial level, 24/7 with the project, plans of publications and other attributes.

17

Re: Assembly CLR with UNSAFE

About, absolutely forgot about the continuous integration.

18

Re: Assembly CLR with UNSAFE

Kolosov wrote:

CLR;
To read lectures the reluctance, but understand, when it is required to retain all it afloat at least at semiindustrial level, 24/7 with the project, plans of publications and other attributes.

Kolosov wrote:

to read lectures the reluctance, but understand, when it is required to retain all it afloat at least at semiindustrial level, 24/7 with the project, plans of publications and other attributes.

If I correctly understood you, threat not in what the sequel starts to fall, and in complexity of attending and development?
Well  if to consider what there are tools ETL. Ssis-packages - them started to refuse more two years ago, at first aside clr, and now aside powershell. On clr some libraries (in the core of abstract, for a call/transport with exterior sources) all remaining is now translated on powershell. At direct hands there are no problems at industrial level with 24/7 and development as a whole is easier and faster, than with ssis.
And what with the continuous integration?

19

Re: Assembly CLR with UNSAFE

And why it is impossible using sp_execute_external_script to launch scripts PowerShell?

20

Re: Assembly CLR with UNSAFE

northern;
Probably because supported languages by the current moment for sp_execute_external_script - phyton and R?
Or you suggest to write a wrapper for start ps?

21

Re: Assembly CLR with UNSAFE

felix_ff wrote:

probably because supported languages by the current moment for sp_execute_external_script - phyton and R?
Or you suggest to write a wrapper for start ps?

So it also causes bewilderment - to have such powerful tool (pws) and not to build in it in sp_execute_external_script
In  the agent after all it is possible to cause a script pws.

22

Re: Assembly CLR with UNSAFE

And people plane crutches))

23

Re: Assembly CLR with UNSAFE

CLR, look as it is possible:

execute sp_execute_external_script
@language = N'Python ';
@script = N'
import subprocess
proc = subprocess. Popen (["powershell", "Get-Variable | ConvertTo-Json"], stdout=subprocess. PIPE, stderr=subprocess. PIPE)
out, err = proc.communicate ()
out = out.decode ("cp866")
err = err.decode ("cp866")
json = out
if len (err)> 0:
json = "the Error!" + err
',
@params = N ' @r_rowsPerRead INT, @json NVARCHAR (MAX) OUTPUT ';
@r_rowsPerRead = @RowsPerRead;
@json = @json OUTPUT
SELECT @json

24

Re: Assembly CLR with UNSAFE

DECLARE did not copy...

--Example of usage of a python for result obtaining (json) from powershell
DECLARE @RowsPerRead INT = 5
DECLARE @json NVARCHAR (MAX)
execute sp_execute_external_script
@language = N'Python ';
@script = N'
import subprocess
proc = subprocess. Popen (["powershell", "Get-Variable | ConvertTo-Json"], stdout=subprocess. PIPE, stderr=subprocess. PIPE)
out, err = proc.communicate ()
out = out.decode ("cp866")
err = err.decode ("cp866")
json = out
if len (err)> 0:
json = "the Error!" + err
',
@params = N ' @r_rowsPerRead INT, @json NVARCHAR (MAX) OUTPUT ';
@r_rowsPerRead = @RowsPerRead;
@json = @json OUTPUT
SELECT @json

25

Re: Assembly CLR with UNSAFE

CLR wrote:

felix_ff,
Well, I it not to you, I wanted to hear in essence from certain clever men, from which here favor 0.0000.
I understood that anything terrible will not be, but it would be desirable to understand, what problems can arise.
"What for?" Is a question more philosophical. If it is not dangerous to a sequel why and not to use such architecture. The purpose - to cause scripts on powershell from tsql which will return a line.

There will be a possibility describe your technique of determination of favor in the form of numbers.
Generally it is possible to make and so:
In that place where you launch "process" - instead  the message to the broker, and the exterior handler of queue (application, service) at handling launches process and does everything that would be desirable, but it is not necessary to do in server procedures.