[Tutor] py-postgressql v1.0.1 question

Rance Hall ranceh at gmail.com
Sun Sep 12 23:42:50 CEST 2010

On Sun, Sep 12, 2010 at 3:53 PM, Bill Allen <wallenpb at gmail.com> wrote:
> Rance,
> I was doing something similar, except I was querying an Oracle database,
> using the cx_Oracle module.  I wanted the non-duplicated count of parts in
> my database that met certain criteria.  All the output that met the criteria
> of the select statements is loaded into the cursor object.  I then loop
> through the cursor object appending the contents into a list.   Then I
> converted the list to a set to blow out the duplicates and then back to a
> list and took the len of the list for my final count.
> #Fetch the list of parts
> cursor.execute("select pobj_name from pfmc_part where pmodel = :arg_1 and
> pstatus = :arg_2", arg_1 = "PN-DWG", arg_2 = "RELEASED")
> for pobj_name in cursor:
>     Parts_List.append(pobj_name)
> print("size of Parts_List before set operation =", len(Parts_List))
> Parts_List = list(set(Parts_List))
> print("size of Parts_List after set operation  =", len(Parts_List))
> Perhaps you could loop though your get_todo object and load into a list and
> do similar or just take a len of it directly if it is already a list.

Thanks for the tip.  I'll do some more research but this sounds promising.


More information about the Tutor mailing list