What is the best way to access stored procedures in Django's ORM

前端 未结 7 1189
轻奢々
轻奢々 2020-12-02 08:44

I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django\'s ORM. Has anyone integrated SP\'s with Django\'s ORM suc

7条回答
  •  醉酒成梦
    2020-12-02 09:24

    Cx_Oracle can be used. Also, It is fairly helpful when we do not have access to production deployed code and need arises to make major changes in database.

    import cx_Oracle
    try:
        db = dev_plng_con
        con = cx_Oracle.connect(db)
        cur = con.cursor()
        P_ERROR = str(error)
        cur.callproc('NAME_OF_PACKAGE.PROCEDURENAME', [P_ERROR])
    
    except Exception as error:
        error_logger.error(message)
    

提交回复
热议问题