Home>

There is a base, there is a table in it, I write a trigger that when updating the table performs a certain Python3 code. Already did this some time ago, but I forgot how to transfer a value from the desired speaker to Python. It seems to be something connected with Pandas for the table parsing.

Example. There is a client table:

Account_Number Amount MGD_UNIQ Name Code Createat
123456789 177.50 79842 NULL NULL 2021-09-14 16:41:51

with Update columns Name. and Code. I want to take value Amount. And use it in the following code example:

Create Trigger Clients_Update
On clients
After Update.
As
Begin.
Execute Sp_execute_External_Script.
@Language= N'Python ',
@Script= n '
Import Requests.
S= Requests.session ()
#Code.
#Code.
#Code.
PAYLOAD= {
    "Amount": Amount,
    }
Headers= {
    "Content-Type": "Application /JSON",
    }
sub_amount= s.post (url, json= payload, headers= headers) ';
End.

Please specify your specific problem or provide more detailed information about what you need. In the current form it is difficult to understand what you are asking.

Дух сообщества2021-09-17 04:24:11

@ Brace community added an example

TheZinter2021-09-17 04:24:11