Python Forum
Fetch Oracle DB rows & print it in HTML file with table's col headers in table format
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fetch Oracle DB rows & print it in HTML file with table's col headers in table format
#1
Hi All,

I am new to python. I am using Python 3.6 in Spyder on Windows OS.

Can you please guide on how to achieve the below one's, I need to fetch Oracle DB rows & print it in HTML file with table's column headers in table format :

1. Fetch some 10 or 20 rows & columns using a Oracle select query (example : SELECT * FROM EMP ORDER BY DEPT_ID).

Note : Here, I am able to connect to Oracle DB using cx_Oracle, and execute and print the output in the terminal window

2. Write the fetched rows into a new HTML file.

Note :
a. Tried filewriter.write(SQL), but not able to print the output in the HTML file. Not sure if i need to use any additional libraries to do this step !

b. I am able to do some sample printing like hi, date in HTML file, just to check if i am able to write into HTML file. For formatting purpose, i tried to add some new empty lines into the HTML file, which is not working. print('\n') or print('\\n') or print('\r\n') or filewrite.writer('\n') are not working, also added sys.stdout=filewriter, still not working. Dont know why!?

3. In HTML, the query output should be written, along with table's column headers and this output should be in table format with table borders ( as we see in the GUI Tools like SQL Developer, TOAD, Etc). How to achieve this?

4. Also, interested to know how to give some bold color to only one column alone. Example : Out of 10 columns fetched to display in HTML file, just put RED color for the 4th column alone
Reply


Messages In This Thread
Fetch Oracle DB rows & print it in HTML file with table's col headers in table format - by tssr_2001 - Sep-03-2020, 04:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to update values in a pyarrow table? xraphael75 0 86 Jan-22-2021, 02:23 PM
Last Post: xraphael75
  Populate a table with variables Market_Python 4 189 Jan-11-2021, 09:45 AM
Last Post: Pedroski55
  Data extraction from a table based on column and row names tgottsc1 1 114 Jan-09-2021, 10:04 PM
Last Post: buran
  Reading csv with multiple "headers" Clives 3 376 Dec-31-2020, 09:25 AM
Last Post: Ana_junior
  How i can add elements to table index of element blazej2533 3 193 Dec-03-2020, 08:16 PM
Last Post: Larz60+
  Load data from One oracle Table to Multiple tables amy83 1 157 Dec-02-2020, 01:57 AM
Last Post: Larz60+
  Creating table in MySQL db with decimal number issue dangermaus33 7 249 Nov-20-2020, 10:40 PM
Last Post: dangermaus33
  CPC File Format (Cartesian Perceptual Compression) - Can Python Convert / Handle Them PSKrieger 2 176 Nov-11-2020, 02:57 PM
Last Post: PSKrieger
  I try to import data from Excel table to Word Template. NewbiePyPy 0 241 Oct-21-2020, 12:25 PM
Last Post: NewbiePyPy
  Newbie Start with Text or Table? abrogard 5 286 Oct-18-2020, 12:47 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020