1

Topic: Does not fulfill procedure from python

Prompt, please, in what a dirty trick?
On a python the script causes stored procedure:

cursor.callproc (' UpdateSeance ', (12345, 2))

All , any errors. But actually procedure does not fulfill, it should 12345 change at a session type on 2 (these parameters and I transfer).
I launch , I see that pymssql was connected and transfers:

exec UpdateSeance 12345, 2

I take I copy this code, I interpose it in SQL SMS and I execute - all , procedure fulfills, the type changes?????!!!! How so that?
Thus all remaining works, if addresses to procedures returning values - all in a python is returned, all in a regular mode. And here I will not understand in what business.

2

Re: Does not fulfill procedure from python

at you and a python the identical? The rights to procedure are given "python"?

3

Re: Does not fulfill procedure from python

wrote:

that pymssql was connected and transfers

Look in a context of what basis there is a call.
And still, demanded UpdateSeance - at you is in the circuit dbo?

4

Re: Does not fulfill procedure from python

wrote:

the Slice;

SET NOCOUNT ON;

If you the HARDWARE is not a context of basis of execution.

5

Re: Does not fulfill procedure from python

Slice;
He not the HARDWARE, but thinks in the correct direction

6

Re: Does not fulfill procedure from python

Cammomile wrote:

Uchetki at you and a python the identical? The rights to procedure are given "python"?

Yes,  identical, actually sa.
The rights, accordingly, too the identical.

wrote:

Look in a context of what basis there is a call.

At me at connection the basis is underlined:

conn.connect (server, user, password, "BASIS")

Especially, "adjacent" procedures which do outswapping of the data - are executed without problems, the data returns.

wrote:

And still, demanded UpdateSeance - at you is in the circuit dbo?

Yes.

wrote:

SET NOCOUNT ON;

And how it helps me?
The given procedure that does not return (me and it is not necessary), it should change a field (it will be reflected in absolutely other program).

7

Re: Does not fulfill procedure from python

Serg58;

wrote:

And how it helps me?
The given procedure that does not return (me and it is not necessary), it should change a field (it will be reflected in absolutely other program).

It at you can a floor-mat swears.
Well and a common story of search of the second sp with another

SELECT * FROM sys.objects WHERE Name = ' UpdateSeance'

How many records?

8

Re: Does not fulfill procedure from python

TaPaK wrote:

it at you can a floor-mat swears.

When I only started to write yesterday a script and wrote a procedure call without parameters - she used foul language.
Then incorrectly parameters transferred, she too used foul language.
Then reached that that no error is present, all is fulfilled, but the field actually does not change. Launched  - I see that the request (it is quoted in the first message) leaves in basis, I take it, I fulfill through SMS - all works.
That is I for the present sit in a debugger of a python and I see errors.

TaPaK wrote:

well and a common story of search of the second sp with another

SELECT * FROM sys.objects WHERE Name = ' UpdateSeance'

How many records?

One record.

9

Re: Does not fulfill procedure from python

... Now tried so to rewrite here, instead of usage callproc (procedure call) normal request:

cursor.execute (' exec UpdateSeance 12345, 2 ')

And here so tried:

args = (12345, 2)
cursor.execute (' exec UpdateSeance %d ', args)

Any errors, all apprx.
But does not work even so. Besides, I copy these requests immediately in SMS - all works.

10

Re: Does not fulfill procedure from python

Serg58;
Well and for our calmness

wrote:

cursor.execute (' exec dbo. UpdateSeance @paramName1 = 12345, @paramName2 = 2 ')

11

Re: Does not fulfill procedure from python

TaPaK wrote:

well and for our calmness

So tried wink
Here now it was once again transversed:

cursor.execute (' exec UpdateSeance @seance = 12345, @type = 2 ')
cursor.execute (' exec dbo. UpdateSeance @seance = 12345, @type = 2 ')

- Are fulfilled WITHOUT errors, but in a DB value does not change.
Both variants through SMS work truly, value changes.
For the sake of interest fulfilled:

cursor.execute (' exec dbo. UpdateSeance @seance = 12345, @type1 = 2 ')

- The python to me produces: "@type1 is not a parameter for procedure..."
If to fulfill here so:

cursor.execute (' exec dbo. UpdateSeance ')

Produces an error: "Procedure or function ' UpdateSeance ' expects parameter ' @seance ', which was not supplied."
Parameter 1 mandatory, just @seance

12

Re: Does not fulfill procedure from python

Serg58;
Well and now there will be that a server not that, the trigger  etc.

13

Re: Does not fulfill procedure from python

! wink
Earned)
Here purely intuitively decided to add in the end of a script:

conn.commit ()

And all works now. Generally all examples set forth above work and through callproc (procedure call) and and through execute

14

Re: Does not fulfill procedure from python

Serg58 wrote:

! wink
Earned)
Here purely intuitively decided to add in the end of a script:

conn.commit ()

And all works now. Generally all examples set forth above work and through callproc (procedure call) and and through execute

https://stackoverflow.com/questions/941 … ure-python

wrote:

conn = pyodbc.connect (driver = ' {SQL Server Native Client 10.0} ', server = ' (local) ', database = ' Inventory ', uid = ' sa ', pwd = ' p $$ w0rd123 ', autocommit=True )

15

Re: Does not fulfill procedure from python

Serg58 wrote:

! wink
Earned)
Here purely intuitively decided to add in the end of a script:

conn.commit ()

And all works now. Generally all examples set forth above work and through callproc (procedure call) and and through execute

*facepalm* That is you simply did not read to dock to the  to connectors? .