Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28824 > unrolled thread

PYODBC Print Cursor Output Question

Started byjames simpson <desolatechair@gmail.com>
First post2012-09-10 07:55 -0700
Last post2012-09-10 17:19 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  PYODBC Print Cursor Output Question james simpson <desolatechair@gmail.com> - 2012-09-10 07:55 -0700
    Re: PYODBC Print Cursor Output Question MRAB <python@mrabarnett.plus.com> - 2012-09-10 17:19 +0100

#28824 — PYODBC Print Cursor Output Question

Fromjames simpson <desolatechair@gmail.com>
Date2012-09-10 07:55 -0700
SubjectPYODBC Print Cursor Output Question
Message-ID<4a3619f2-721a-4aca-9a97-f90aaf6a1346@u15g2000yql.googlegroups.com>
I think there's a simple answer but displaying my ignorance here.
I'm
using Python 2.7.3 IDLW with pydoc 3x

I think I've connected to my SQL Server 2005 and my SQL is good.

How do I display the actual data returned from my fetch?  Been
searching for several hours but no joy...

Thanks. Jamie

===============================================
>>> cursor.execute("select * from project")

row = cursor.fetchone()
if row:
    print row

<pyodbc.Cursor object at 0x0167D678>   I'd like to actually see SQL
output here?)

[toc] | [next] | [standalone]


#28830

FromMRAB <python@mrabarnett.plus.com>
Date2012-09-10 17:19 +0100
Message-ID<mailman.452.1347293956.27098.python-list@python.org>
In reply to#28824
On 10/09/2012 15:55, james simpson wrote:
> I think there's a simple answer but displaying my ignorance here.
> I'm
> using Python 2.7.3 IDLW with pydoc 3x
>
> I think I've connected to my SQL Server 2005 and my SQL is good.
>
> How do I display the actual data returned from my fetch?  Been
> searching for several hours but no joy...
>
> Thanks. Jamie
>
> ===============================================
>>>> cursor.execute("select * from project")
>
> row = cursor.fetchone()
> if row:
>      print row
>
> <pyodbc.Cursor object at 0x0167D678>   I'd like to actually see SQL
> output here?)
>
>
Try this:

 >>> results = cursor.execute("select * from project")
 >>> row = results.fetchone()
 >>> print row

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web