Python connection to Oracle database
Question: I am writing a Python script to fetch and update some data on a remote oracle
database from a Linux server. I would like to know how can I connect to remote
oracle database from the server.  
Do I necessarily need to have an oracle client installed on my server or any
connector can be used for the same?  
And also if I use `cx_Oracle` module in Python, is there any dependency that
has to be fulfilled for making it work?


Answer: You have to Install Instance_client for cx_oracle driver to interact with
remote oracle server

<http://www.oracle.com/technetwork/database/features/instant-
client/index-097480.html>.

Use SQLAlchemy (Object Relational Mapper) to make the connection and interact
with Oracle Database.

The below code you can refer for oracle DB connection.

> > > from sqlalchemy import create_engine
>>>

>>> from sqlalchemy.orm import sessionmaker

>>>

>>> engine = create_engine('oracle+cx_oracle://test_user:test_user@ORACSG')

>>>

>>> session_factory = sessionmaker(bind=engine, autoflush=False)

>>>

>>> session = session_factory()

>>>

>>> res = session.execute("select * from emp");

>>>

>>> print res.fetchall()

