Connecting to Oracle databases from Python provides the ability to run essential SQL queries that can be used in geoprocessing tasks.
Instructions provided describe how to connect to an Oracle database and run SQL queries from a Python script.
Note: Ensure that you have fulfilled the prerequisites described the Overview section of the installation instructions, and have downloaded and installed the Oracle Client Libraries before making a connection to the database.
connection = cx_Oracle.connect('sde/sde@orcl')
Note: If an error is returned containing the message "Error: No module named cx_Oracle", verify the installation of the cx_Oracle module.
cursor = connection.cursor()
querystring = "select * from Parcels"