from sqlalchemy import Column
from sqlalchemy.dialects.oracle import DATE, NUMBER, VARCHAR
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class MidTaskCtl(Base):
'''
bs_tb_mid_task_ctrl表的ORM类
'''
__tablename__="BS_TB_MID_TASK_CTRL"
SEQNO = Column(NUMBER,primary_key=True) #NUMBER(10)
PNAME = Column(VARCHAR(10)) #VARCHAR2(10)
BILLING_CYCLE_ID = Column(NUMBER) #NUMBER(9)
TASK_NAME = Column(VARCHAR(50)) #VARCHAR2(50)
OBJECT_NAME = Column(VARCHAR(50)) #VARCHAR2(50)
ATTR1 = Column(VARCHAR(300)) #VARCHAR2(300)
ATTR2 = Column(VARCHAR(300)) #VARCHAR2(300)
ATTR3 = Column(VARCHAR(300)) #VARCHAR2(300)
CREATE_DATE = Column(DATE) #DATE
STATUS_DATE = Column(DATE) #DATE
'''
以上是数据库表的定义
下面对date字段的赋值方法如下
'''
from datetime import datetime
task.CREATE_DATE=datetime.now()
task.STATUS_DATE=datetime(2018,4,25,15,47,30)