[Tutor] Python in Vertica

Emile van Sebille emile at fenx.com
Mon Sep 10 23:20:18 CEST 2012


On 9/10/2012 1:49 PM C.L. Shetline said...
> 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

Please show us this conditional and how you build it...


> it does not work.


... and include the traceback so that we see both your input and the 
error that's output.

Emile



> 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
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>




More information about the Tutor mailing list