Python Forum
python extract - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: python extract (/thread-38596.html)



python extract - mg24 - Nov-02-2022

Hi Team,

I am calling a stored procedure , and it is giving me output of 20 columns and 16 records below it.
result = cursor.fetchall()

my requirement now.

I want specific columns from result. cursor.
col1,col2,col3,col4,col5,col6,col7,col8,col12,col15.

1) I have one solution in my mind.
select col1,col2,col3,col4,col5,col6,col7,col8,col12,col15. from table1.

But I want data from result records.


fetchall gives below result.
helper1 helper2 helper3 helper5 col6 col7 col8 col9 col10
xxx xxx xxx xxx yyy yyy yyy yyy yyy
xxx xxx xxx xxx yyy yyy yyy yyy yyy
xxx xxx xxx xxx yyy yyy yyy yyy yyy
xxx xxx xxx xxx yyy yyy yyy yyy yyy

from this I want col6 col7 col8 col9 col10
and its record into csv.


Thanks
mg


RE: python extract - Larz60+ - Nov-02-2022

Hard to say without seeing your code. Or at least post the stored procedure.
I'll assume you're using an SQL query.
If that is the case, you can specify the actual columns in the query.