我正在尝试从返回的数据库对象中获取字段名称和记录值。我有一个用于查询执行的 datahandler.py 文件。当我从一个源文件中点击数据处理程序方法(例如GetEmployeeinfo(id))时,它返回一个对象。我想知道如何从 GetEmployeeinfo(id) 返回的对象中获取字段名称和记录值。
MyCode 看起来像这样:
雇员.py
class EmployeeForm(BrowserView)
def getEmployee(self):
handler=self.MyDBHandler()
emp_info=handler.GetEmployeeinfo(id=1) // this return the object from a
GetEmployeeinfo(id)
return emp_info
dbhandler.py
class MyDBhandler():
def GetEmployeeinfo(id,dic=0)
//some select statement query goes here
return []
// it return the object instance like "<My.Product.dbhandler.xxxx>"
我想知道如何从 Employee.py 文件中的返回对象中获取字段名称和记录,以将其返回到渲染页面。
提前致谢。