DavidA wrote:
>> I am wondering how to retrieve a collection of columns within a table,
>> whilst using the standard python dbapi2 functionality.
> 
> Do you mean cursor.description?
> 
> cursor = connection.cursor()
> cursor.execute('select * from blog_post where 1 = 0')
> for col in cursor.description:
>     print col
> 
> Each col is a 7-item sequence containing column name, type_code,
> display_size, internal_size, precision, scale, and null_ok)
> 
> http://www.python.org/dev/peps/pep-0249/

Thanks!

Although this cannot be used as the final solution, it keeps me running 
now, thus I can test the code.

sqlite3 has problems with this function, it returns only the column name:

http://initd.org/pub/software/pysqlite/doc/usage-guide.html#python-database-api-2-0-compliance

Additionally, it looks that "description" will be empty, if no rows are 
returned.

But as said, I can continue with testing now!

.

-- 
http://lazaridis.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to