platiumky / pymssql

Automatically exported from code.google.com/p/pymssql
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Add MSSQLConnection.debug_queries attribute to 2.0.x #98

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Install pymssql 2.0.0b1-dev-20111019
2. import _mssql 
3. print hasattr(_mssql.MssqlConnection, 'debug_queries' )

What is the expected output? What do you see instead?
I expect to see (True)
I get a result of (False)

What version of the product are you using? On what operating system?
2.0.0b1-dev-20111019 (PYPI) on Ubuntu Server 12.4

Please provide any additional information below.
If the debug_queries argument was intentionally removed from version 2.x I 
would be glad to help update the documentation.

Thank you for your hard work, and a great driver!

Original issue reported on code.google.com by Ben.DeM...@gmail.com on 6 Aug 2012 at 8:53

GoogleCodeExporter commented 8 years ago
I can also verify this attribute is missing in pymssql-2.0.0b1-dev-20111019.

Has this be removed on purpose? It would be nive to have this attribute back 
again :-)

Thanks

Original comment by franc...@herbert.org.nz on 16 Aug 2012 at 1:04

GoogleCodeExporter commented 8 years ago
It also seems to be missing from 1.9.909-dev (installed from the Ubuntu repos 
on Ubuntu 12.04). I cannot seem to find any documentation of when it was 
removed/replaced, or what to use in it's absence. The wiki still seems to 
reference it too.

Original comment by jo...@ridersdiscount.com on 16 Aug 2012 at 3:40

GoogleCodeExporter commented 8 years ago
I too have noticed this issue, what happened to 'debug_queries' ?

Original comment by wesrhan...@gmail.com on 24 Aug 2012 at 2:31

GoogleCodeExporter commented 8 years ago
I, unfortunately, can't say for sure.  The code between 1.x and 2.x has changed 
significantly going from pure C to using Cython.  If someone would like to take 
a look at the old code and give a patch for similar functionality, I'd be happy 
to entertain it.  Unfortunately, its not likely to happen otherwise as I am 
seem to be the sole maintainer and haven't had time to really work on this for 
over a year now.

Original comment by rsyr...@gmail.com on 24 Aug 2012 at 7:39

GoogleCodeExporter commented 8 years ago
I really appreciate this module. It's way more efficient than using the 
alternative pyodbc module with FREETDS.
I'll take a look at it as soon as I have time and see if I can't patch it - 
I'll keep everyone updated here.

Original comment by b...@ridersdiscount.com on 24 Aug 2012 at 7:45

GoogleCodeExporter commented 8 years ago
To make this a bit clearer, let me show an example of how this feature works 
with pymssql==1.0.2:

$ cat test_mssql.py import _mssql

conn = _mssql.connect(server="127.0.0.1", user="user", password="password", database="pymssql_dev") conn.debug_queries = True conn.execute_query("SELECT @@version AS version") for row in conn: print(row['version'])

$ python test_mssql.py

SELECT @@version AS version

Microsoft SQL Server 2012 - 11.0.2100.60 (X64) Feb 10 2012 19:39:15 Copyright (c) Microsoft Corporation Developer Edition (64-bit) on Windows NT 6.1 (Build 7601: Service Pack 1)

Original comment by msabr...@gmail.com on 25 Aug 2013 at 11:14

GoogleCodeExporter commented 8 years ago
This should do it:

https://gist.github.com/msabramo/6343042

Original comment by msabr...@gmail.com on 26 Aug 2013 at 3:54

GoogleCodeExporter commented 8 years ago

Original comment by msabr...@gmail.com on 27 Aug 2013 at 2:49

GoogleCodeExporter commented 8 years ago
Fixed with:

https://code.google.com/p/pymssql/source/detail?r=04c205f2f7990bd3a40a3afb29efff
32c64a9914

If folks can verify with the hg tip, that would be great!

Original comment by msabr...@gmail.com on 27 Aug 2013 at 2:59