Skip to content

Instantly share code, notes, and snippets.

@timfreund
Created July 25, 2014 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timfreund/2323960da89a18c98308 to your computer and use it in GitHub Desktop.
Save timfreund/2323960da89a18c98308 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import cx_Oracle
username = "user"
password = "pass"
database = "tnsname"
con = cx_Oracle.connect(username, password, database)
cur = con.cursor()
results = cur.execute("select file_id, encrypted_data from bank_file where disbursement_file_id in (1, 2, 3)")
for row in results:
disb_file = open("%s_%d" % (database, row[0]), "w")
disb_file.write(row[1])
disb_file.close()
cur.close()
con.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment