当我使用sqlalchemy创建表时,出现了错误,并且在字段中没有保留关键字:
from sqlalchemy import create_engine
from sqlalchemy import text
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String,Float,TIMESTAMP
from sqlalchemy.orm import scoped_session, sessionmaker
Base = declarative_base()
DBSession = sessionmaker(bind=engine)
session = DBSession()
class Ibm_Batch_Tbl_Copy(Base):
__tablename__ = "IBM_BATCH_TBL_COPY"
DB_CODE = Column(String(50),primary_key=True)
DB_OWNER = Column(String(30),primary_key=True)
TABLE_NAME = Column(String(128),primary_key=True)
ROW_CNT = Column(Integer,nullable=True)
TABLE_TIME = Column(Float(64),nullable=True)
DAY_ID = Column(String(10),nullable=True)
BAT_NO = Column(String(20),nullable=True)
INSERT_TIME = Column(TIMESTAMP(timezone=False),nullable=False,server_default=text("NOW()"))
DEL_FLAG = Column(String(1),nullable=True,server_default=text('0'))
REMARK = Column(String(500),nullable=True)
当我使用Base.metadata.create_all(engine)
创建表时,出现了错误。