Search code examples
pythonoracle-databaseflaskcx-oracle

Does cx_Oracle works with flask-python?


I'm wondering if cx_Oracle works with flask-python.

if so, please share with me a good documentation. it will be great.

Thank you All for your help.


Solution

  • See my blog post How to use Python Flask with Oracle Database which has a runnable example.

    The key thing is that during application initialization you will want to start a connection pool with cx_Oracle.SessionPool(). Then each route can get a connection from the pool with connection = pool.acquire()

    Also see https://www.oracle.com/webfolder/technetwork/tutorials/obe/cloud/apaas/python/python-oracle-accs/python-oracle-accs.html, however this doesn't use a connection pool so it has some scalability limitations.