Created
July 11, 2019 18:18
-
-
Save nodamu/5fe7483c424ebd8a2e8789a1a349f91f to your computer and use it in GitHub Desktop.
simple cron
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #-----ORACLE SECTION---------# | |
| import cx_Oracle | |
| from pptx import Presentation | |
| try: | |
| dsn_tns = cx_Oracle.makedsn('Host Name', 'Port Number', service_name='Service Name') | |
| conn = cx_Oracle.connect(user=r'User Name', password='Personal Password', dsn=dsn_tns) | |
| # Now execute the sqlquery | |
| cursor = conn.cursor() | |
| cursor.execute("insert into student values(19585, Niranjan Shukla, 72000") | |
| for row in cursor: | |
| print (row[0], '-', row[1]) | |
| # commit that insert the provided data | |
| # con.commit() | |
| prs = Presentation() | |
| title_slide_layout = prs.slide_layouts[0] | |
| slide = prs.slides.add_slide(title_slide_layout) | |
| title = slide.shapes.title | |
| subtitle = slide.placeholders[1] | |
| title.text = "Hello, World!" | |
| subtitle.text = "python-pptx was here!" | |
| prs.save('test.pptx') | |
| cursor.close() | |
| except cx_Oracle.DatabaseError as e: | |
| print("There is a problem with Oracle", e) | |
| # by writing finally if any error occurs | |
| # then also we can close the all database operation | |
| finally: | |
| if cursor: | |
| cursor.close() | |
| if conn: | |
| conn.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment