flask_sqlalchemy在执行插入数据的时候报错:表 'itm3_invo_bill' 没有标识属性。

flask_sqlalchemy在执行插入数据的时候报错:表 'itm3_invo_bill' 没有标识属性。

我在尝试使用flask_sqlalchemy往数据库插入数据的时候报错了:

sqlalchemy.exc.ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]表 'itm3_invo_bill' 没有标识属性。无法执行 SET 操作。 (8106) (SQLExecDirectW)")

[SQL: SET IDENTITY_INSERT itm3_invo_bill ON]

(Background on this error at: https://sqlalche.me/e/14/f405)

我的python更新代码是:

max_phid = db.session.query(db.func.max(itm3_invo_bill.phid+1)).scalar()

print("max_phid=",max_phid)

itm3_invo_bill_text = itm3_invo_bill(phid = max_phid,invo_code='23038848', invo_no='875412462')

db.session.add_all([itm3_invo_bill_text])

db.session.commit()

我不理解的是,在navicat里面如果执行这个语句的SQL,它并没有报错:

INSERT INTO itm3_invo_bill (phid, invo_code, invo_no)

VALUES (502210817000106, '23038848', '875412462');

navicat提示:

[SQL]INSERT INTO itm3_invo_bill (phid, invo_code, invo_no)

VALUES (502210817000106, '23038848', '875412462')

受影响的行: 1

时间: 0.001s

我不理解flask_sqlalchemy的工作方式,我这里问题出在了哪里?我应该如何处理这个ERROR?

表结构如下:

CREATE TABLE [dbo].[itm3_invo_bill] (

[phid] bigint NOT NULL ,

[bill_type] tinyint NULL ,

[addtype] tinyint NULL ,

[phid_invo_type] bigint NULL ,

[invo_state] tinyint NULL ,

[invo_code] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[invo_no] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[invo_date] datetime NULL ,

[phid_proj] bigint NULL ,

[amount] numeric(18,6) NULL ,

[taxes] numeric(18,6) NULL ,

[havemoney] numeric(18,6) NULL ,

[invo_rate] numeric(18,6) NULL ,

[sell_comptax] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_ent_sell] bigint NULL ,

[own_comptax] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_ent_own] bigint NULL ,

[uyear] varchar(4) COLLATE Chinese_PRC_CI_AS NULL ,

[mon] int NULL ,

[invo_key] varchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[invo_key2] varchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[invo_key3] varchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[invo_key4] varchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_org] bigint NULL ,

[remark] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ,

[image_address] varchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_impose] bigint NULL ,

[phid_taxes_type] bigint NULL ,

[phid_struct_type] bigint NULL ,

[phid_scrappsn] bigint NULL ,

[scrapdate] datetime NULL ,

[phid_inputpsn] bigint NULL ,

[inputdate] datetime NULL ,

[phid_manager] bigint NULL ,

[pre_choice] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[choice] int NULL ,

[choicedate] datetime NULL ,

[passok] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[passtype] tinyint NULL ,

[pass_year] varchar(4) COLLATE Chinese_PRC_CI_AS NULL ,

[pass_mon] int NULL ,

[phid_passpsn] bigint NULL ,

[phid_account_org] bigint NULL ,

[finflag] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_pznum] bigint NULL ,

[bill_confirm] int NULL ,

[phid_confirm_psn] bigint NULL ,

[hx_flag] int NULL ,

[hx_type] varchar(10) COLLATE Chinese_PRC_CI_AS NULL ,

[isonekp_sg] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[hx_wkpxs] varchar(10) COLLATE Chinese_PRC_CI_AS NULL ,

[unsell_hx_flag] varchar(2) COLLATE Chinese_PRC_CI_AS NULL ,

[accept_status] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_express] bigint NULL ,

[is_choose] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_pre_bill] bigint NULL ,

[gathbill_flag] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[ishpay_tax] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[invo_address] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ,

[login_types] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[contractno] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[goodsno] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[machineno] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_cnt] bigint NULL ,

[fp_je] numeric(18,2) NULL ,

[fp_type] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_outcert] bigint NULL ,

[err_info] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ,

[actflag] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_tax_org] bigint NULL ,

[already_atmount] numeric(18,6) NULL ,

[absence_atmount] numeric(18,6) NULL ,

[now_atmount] numeric(18,6) NULL ,

[related_type] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[invo_platform] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[split_flag] varchar(2) COLLATE Chinese_PRC_CI_AS NULL ,

[check_no] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[sync_flag] varchar(50) COLLATE Chinese_PRC_CI_AS NULL ,

[taxpayername] varchar(400) COLLATE Chinese_PRC_CI_AS NULL ,

[dedmoney] numeric(18,2) NULL ,

[supplyfileblacklist] varchar(2) COLLATE Chinese_PRC_CI_AS NULL ,

[invoiceprove] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ,

[is_out_flag] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[pay_outtype] tinyint NULL ,

[phid_outtype] bigint NULL ,

[inv_outmoney] numeric(18,6) NULL ,

[already_outbill_amount] numeric(18,6) NULL ,

[already_outbill_outmoney] numeric(18,6) NULL ,

[no_atmount] numeric(18,6) NULL ,

[diff_invo] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[diff_deduction] numeric(18,6) NULL ,

[blue_invo_code] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[blue_invo_no] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[cur_orgid] bigint NULL ,

[creator] bigint NULL ,

[editor] bigint NULL ,

[ng_insert_dt] datetime NULL ,

[ng_update_dt] datetime NULL ,

[ng_record_ver] int NULL ,

[checktype] tinyint NULL ,

[phid_checkpsn] bigint NULL ,

[checkdate] datetime NULL ,

[rec_pay_amount] numeric(18,2) NULL ,

[phid_pre_choice_psn] bigint NULL ,

[pre_choice_date] datetime NULL ,

[phid_balance] bigint NULL ,

[e_bill] varchar(2) COLLATE Chinese_PRC_CI_AS NULL ,

[business_flag] varchar(2) COLLATE Chinese_PRC_CI_AS NULL ,

[inv_name_detail] varchar(4000) COLLATE Chinese_PRC_CI_AS NULL ,

[validateimgname] varchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_invo_use] bigint NULL ,

[phid_invo_disuse] bigint NULL ,

[pay_flg] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[tr_no] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[tr_type] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[tr_date] datetime NULL ,

[ref_bill_type] int NULL ,

[receiver] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[tax_org_name] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[tax_org_code] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[bill_id] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[package_code] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[use_flg] tinyint NULL ,

[onlypic] tinyint NULL ,

[use_type] tinyint NULL ,

[httpflag] tinyint NULL ,

[isbxd] tinyint NULL ,

[ifbx] tinyint NULL ,

[is_verif] varchar(10) COLLATE Chinese_PRC_CI_AS NULL ,

[imposetype] tinyint NULL ,

[phid_tax_fp_mst] bigint NULL ,

[single_in] tinyint NULL ,

[batch_taxes] numeric(18,6) NULL ,

[batch_outbill_outmoney] numeric(18,6) NULL ,

[batch_outbill_amount] numeric(18,6) NULL ,

[init_flag] tinyint NULL ,

[otherpay_ref] int NULL ,

[save_index] int NULL ,

[redcode] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[fin_mon] int NULL ,

[fin_uyear] varchar(4) COLLATE Chinese_PRC_CI_AS NULL ,

[red_used] tinyint NULL ,

[billtobank] varchar(120) COLLATE Chinese_PRC_CI_AS NULL ,

[is_receive_before] int NULL ,

[cnt_amount] numeric(18,6) NULL ,

[is_multi_proj] tinyint NULL ,

[extend_code1] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[extend_name1] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ,

[extend_code2] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[extend_name2] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ,

[extend_code3] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[extend_name3] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ,

[pay_ment_type] int NULL ,

[absence_tax_atmount] numeric(18,6) NULL ,

[now_tax_atmount] numeric(18,6) NULL ,

[already_tax_atmount] numeric(18,6) NULL ,

[hx_ysk] varchar(1) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_relinvo] bigint NULL ,

[is_sj] tinyint NULL ,

[red_money] numeric(18,6) NULL ,

[ysk_kj_money] numeric(18,6) NULL ,

[phid_passenger] bigint NULL ,

[kcrate] numeric(18,6) NULL ,

[pre_choice_year] varchar(4) COLLATE Chinese_PRC_CI_AS NULL ,

[pre_choice_mon] int NULL ,

[deduction_finflag] tinyint NULL ,

[deduction_tr_no] varchar(100) COLLATE Chinese_PRC_CI_AS NULL ,

[deduction_tr_type] varchar(80) COLLATE Chinese_PRC_CI_AS NULL ,

[deduction_tr_date] datetime NULL ,

[copies] int NULL ,

[scan_insert_dt] varchar(40) COLLATE Chinese_PRC_CI_AS NULL ,

[print_number] int NULL ,

[receive_date] datetime NULL ,

[phid_consignee] bigint NULL ,

[passenger_name] varchar(50) COLLATE Chinese_PRC_CI_AS NULL ,

[is_serialnum] int NULL ,

[onekp_date] datetime NULL ,

[outmoney] numeric(16,2) NULL ,

[outmoneystate] tinyint NULL ,

[scm_isrelbill] int NULL ,

[from_type] varchar(50) COLLATE Chinese_PRC_CI_AS NULL ,

[is_partialout_flag] tinyint NULL ,

[effective_tax] numeric(18,6) NULL ,

[partial_deduction] tinyint NULL ,

[is_overday] tinyint NULL ,

[export_rebate] tinyint NULL ,

[bill_from] int NULL ,

[user_dw] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[user_gx_djbm] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[user_gx_nccbs] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[user_gx_fpid] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[ticket_price] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[other_taxes] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[user_nccbs] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_inv_name] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_declaration_item] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_phid_invo_type] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[tr_num] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_schemeid] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[imp_info] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_sourcemids] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_sourcemid] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[is_block_chain] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_deduct_account_org] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[is_tally_receive] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[is_pass_receive] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[flight_number] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[flight_time] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[passenger_code] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[civil_aviation_fund] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[fuel_surcharge] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[departure] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[destination] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[seat_level] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[ticket_number] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[begin_date] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[end_date] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[train_number] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[car_model] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[vehicel_type] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[var_vin_code] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[register_num] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[amileage] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[alocation] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[atransaction_number] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[amed_insti_type] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[asex] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[ainvo_time] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aphid_biz_bill] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[acost_price] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[ainneremp] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aphid_paybill] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[abill_no] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aphid_cbs] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[abw_task_no] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aperson_flag] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aneioutmoney] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aneioutmoneystate] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[akc_taxes] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aimage_url] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aphid_assign_proj] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aphid_declaration] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[atr_acc] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[adeduction_tr_acc] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[areplace_flag] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[areplace_money] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aasr_flg] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[awf_flag] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aphid_pc] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aphid_app] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aapp_status] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[aapp_dt] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[atr_flag] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[mileage] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[location] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[transaction_number] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[med_insti_type] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[sex] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[invo_time] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_biz_bill] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[cost_price] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[inneremp] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_paybill] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[bill_no] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_cbs] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[bw_task_no] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[person_flag] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[neioutmoney] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[neioutmoneystate] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[kc_taxes] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[image_url] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_assign_proj] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_declaration] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[tr_acc] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[deduction_tr_acc] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[replace_flag] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[replace_money] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[asr_flg] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[wf_flag] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_pc] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[phid_app] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[app_status] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[app_dt] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

[tr_flag] nvarchar(200) COLLATE Chinese_PRC_CI_AS NULL ,

CONSTRAINT [pk_itm3_invo_bill] PRIMARY KEY NONCLUSTERED ([phid])

)

ON [PRIMARY]

GO

CREATE UNIQUE INDEX [itm3_invo_bill01] ON [dbo].[itm3_invo_bill]

([invo_code] ASC, [invo_no] ASC, [bill_type] ASC)

WITH (IGNORE_DUP_KEY = ON)

ON [PRIMARY]

GO

flask_sqlalchemy 对应的itm3_invo_bill模型如下:

class itm3_invo_bill(db.Model):

__tablename__ = "itm3_invo_bill"

phid = db.Column(db.Integer,primary_key=True)

phid_proj = db.Column(db.Integer,nullable=True)

phid_org = db.Column(db.Integer,nullable=True)

phid_invo_type = db.Column(db.Integer,nullable=True)

invo_code = db.Column(db.String(80),nullable=True,unique=True,index=True)

invo_no = db.Column(db.String(80),nullable=True,unique=True,index=True)

invo_date = db.Column(db.DateTime,nullable=True)

amount = db.Column(db.Float,nullable=True)

invo_rate = db.Column(db.Float,nullable=True)

taxes = db.Column(db.Float,nullable=True)

havemoney = db.Column(db.Float,nullable=True)

taxpayername = db.Column(db.String(400),nullable=True)

sell_comptax = db.Column(db.String(80),nullable=True)

invo_state = db.Column(db.Integer,nullable=True)

car_model = db.Column(db.String(200),nullable=True)

vehicel_type = db.Column(db.String(200),nullable=True)

var_vin_code = db.Column(db.String(200),nullable=True)

register_num = db.Column(db.String(200),nullable=True)

flight_number = db.Column(db.String(200),nullable=True)

ticket_price = db.Column(db.String(200),nullable=True)

civil_aviation_fund = db.Column(db.String(200),nullable=True)

fuel_surcharge = db.Column(db.String(200),nullable=True)

other_taxes = db.Column(db.String(200),nullable=True)

cost_price = db.Column(db.String(200),nullable=True)

passenger_name = db.Column(db.String(50),nullable=True)

own_comptax = db.Column(db.String(80),nullable=True)

user_gx_djbm = db.Column(db.String(200),nullable=True)

user_gx_fpid = db.Column(db.String(200),nullable=True)

passtype = db.Column(db.Integer,nullable=True)

user_nccbs = db.Column(db.String(200),nullable=True)

inv_name_detail = db.Column(db.String(4000),nullable=True)

user_dw = db.Column(db.String(200),nullable=True)

bill_type = db.Column(db.Integer,nullable=True,unique=True,index=True)

copies = db.Column(db.Integer, default=1)

uyear = db.Column(db.String(4),nullable=True)

mon = db.Column(db.Integer,nullable=True)

inputdate = db.Column(db.DateTime, default=datetime.datetime.now)


回答:

表结构 DUMP 贴一下看看。

设主键了吗?

以上是 flask_sqlalchemy在执行插入数据的时候报错:表 'itm3_invo_bill' 没有标识属性。 的全部内容, 来源链接: utcz.com/p/938086.html

回到顶部