[Tutor] Python in Vertica

C.L. Shetline ikit123 at hotmail.com
Mon Sep 10 22:49:16 CEST 2012




Python 2.4.3 with Vertica Database on Linux.

We are migrating from an Informix database to Vertica. We have C code and a lot of
SQL Stored procedures in our Informix db that are not viable in Vertica. We are trying
to convert them to Python.

My first questions is:

I am using pyodbc to connect to the Vertica database. When I do a select on count and
print the result it displays as (for example) 4L (which is the row count plus the
data type). If I try to use the variable in a conditional it does not work. I have no idea how
to have data value simply be 4 !

cursor.execute("SELECT COUNT(*) from cv_gls_wkly_misc")
result = cursor.fetchone()
number_of_rows = result[0]
print `number_of_rows


The data display is the (select count(*)) and a selected row.
4L
[(5185L, 93L, Decimal("42.50"), Decimal("50.36"), Decimal("3406.35"), Decimal("0"), Decimal("78.00"), Decimal("0"), Decimal("66.00"), Decimal("0"), Decimal("12.73"), Decimal("0"), Decimal("0"), Decimal("311.00"))]

Regards,
CVez

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120910/b9cfc2f9/attachment-0001.html>


More information about the Tutor mailing list