How to execute SQL code into Python Code?
SELECT RiskID.RiskID, RiskID.FuncID1, FUNCID.TCODE FROM RiskID INNER JOIN FUNCID ON RiskID.FuncID1 = FUNCID.FUNCID
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
How to execute SQL code into Python Code?
SELECT RiskID.RiskID, RiskID.FuncID1, FUNCID.TCODE FROM RiskID INNER JOIN FUNCID ON RiskID.FuncID1 = FUNCID.FUNCID
Hello,
You can try below code maybe it helps you
query = """(SELECT RiskID.RiskID, RiskID.FuncID1, FUNCID.TCODE FROM RiskID INNER JOIN FUNCID ON RiskID.FuncID1 = FUNCID.FUNCID)"""
cr = self._cr
cr.execute(query)
Thanks
Use below mentioned code: sql = """select count(name) from table_name where lower(field_name) = lower('%s') """ % self.field_name self.env.cr.execute(sql)
Hello
use self._cr.execute() to execute your sql query.
for eg. self._cr.execute("""SELECT RiskID.RiskID, RiskID.FuncID1, FUNCID.TCODE FROM RiskID INNER JOIN FUNCID ON RiskID.FuncID1 = FUNCID.FUNCID """)
then you can get your result using below code:
result = self._cr.dictfetchall() or result = self._cr.fetchall()
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up