Skip to content

Instantly share code, notes, and snippets.

@MartinMacharia
Created November 18, 2019 06:09
Show Gist options
  • Save MartinMacharia/8a74bd7814f49a040f2eb14b69a8d003 to your computer and use it in GitHub Desktop.
Save MartinMacharia/8a74bd7814f49a040f2eb14b69a8d003 to your computer and use it in GitHub Desktop.
Oracle DB connection
import cx_Oracle
import pandas as pd
import csv
ip = '**********'
port = ****
SID = '********'
dsn_tns = cx_Oracle.makedsn(ip, port, SID)
conn = cx_Oracle.connect('DB_USERNAME', 'DB_PASSWORD', dsn_tns)
c = conn.cursor()
cb23_jan2019 = """
select * from schema.table
"""
cb26_Feb2019_selfcure = pd.read_sql(cb26_Feb2019_selfcure, conn)
cb26_Feb2019_selfcure.to_csv(r'P:/Martin/cb26_Feb2019_selfcure.csv', index=None, header=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment