from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import Config2
import pymysql
import numpy as np
import json pymysql.install_as_MySQLdb()
app = Flask(__name__)
app.config.from_object(Config2)
db = SQLAlchemy(app) class Basic(object):
"""企业照面(基本)信息(行内客户) model""" def __init__(self,
prmsn_oprt_prj_dsc=np.nan,
lout_dt=np.nan,
rvk_dt=np.nan,
idy_tpcd=np.nan,
bsnlcns_no=np.nan,
old_bsnlcns_no=np.nan,
lgl_rprs_nm=np.nan,
entp_info_idr=np.nan,
orgacinccptl_amt=np.nan,
rgst_cpamt=np.nan,
rgst_cptl_ccycd=np.nan,
oprt_stcd=np.nan,
org_char_cd=np.nan,
org_estb_dt=np.nan,
oprt_trm_stdt=np.nan,
dtl_adr=np.nan,
issuctf_aht_nm=np.nan,
entnm=np.nan,
unn_soc_cr_cd=np.nan):
self.prmsn_oprt_prj_dsc = prmsn_oprt_prj_dsc
self.lout_dt = lout_dt
self.rvk_dt = rvk_dt
self.idy_tpcd = idy_tpcd
self.bsnlcns_no = bsnlcns_no
self.old_bsnlcns_no = old_bsnlcns_no
self.lgl_rprs_nm = lgl_rprs_nm
self.entp_info_idr = entp_info_idr
self.orgacinccptl_amt = orgacinccptl_amt
self.rgst_cpamt = rgst_cpamt
self.rgst_cptl_ccycd = rgst_cptl_ccycd
self.oprt_stcd = oprt_stcd
self.org_char_cd = org_char_cd
self.org_estb_dt = org_estb_dt
self.oprt_trm_stdt = oprt_trm_stdt
self.dtl_adr = dtl_adr
self.issuctf_aht_nm = issuctf_aht_nm
self.entnm = entnm
self.unn_soc_cr_cd = unn_soc_cr_cd def __repr__(self):
return repr((self.
self.prmsn_oprt_prj_dsc,
self.lout_dt,
self.rvk_dt,
self.idy_tpcd,
self.bsnlcns_no,
self.old_bsnlcns_no,
self.lgl_rprs_nm,
self.entp_info_idr,
self.orgacinccptl_amt,
self.rgst_cpamt,
self.rgst_cptl_ccycd,
self.oprt_stcd,
self.org_char_cd,
self.org_estb_dt,
self.oprt_trm_stdt,
self.dtl_adr,
self.issuctf_aht_nm,
self.entnm,
self.unn_soc_cr_cd)) class Alter:
"""企业历史变更信息 Model""" def __init__(self,
mdf_bfr_cntnt=np.nan,
mdf_dt=np.nan,
mdf_itm=np.nan,
afmd_cntnt=np.nan,
):
self.mdf_bfr_cntnt = mdf_bfr_cntnt
self.mdf_dt = mdf_dt
self.mdf_itm = mdf_itm
self.afmd_cntnt = afmd_cntnt def __repr__(self):
return repr((self.mdf_bfr_cntnt, self.mdf_dt, self.mdf_itm, self.afmd_cntnt)) class Person:
"""主要管理人员(行内客户)""" def __init__(self,
ip_nm=np.nan,
post_tp_cd=np.nan,
gnd_cd=np.nan):
self.ip_nm = ip_nm
self.post_tp_cd = post_tp_cd
self.gnd_cd = gnd_cd def __repr__(self):
return repr((self.
self.ip_nm,
self.post_tp_cd,
self.gnd_cd)) class Punished:
"""被执行人信息 Punished""" def __init__(self, punished_cnt=np.nan,
court_putonrcrd_fsttapp=np.nan,
court_putonrcrd_lsttapp=np.nan,
cs_stdsc1_cnt=np.nan,
cs_stdsc2_cnt=np.nan,
cs_stdsc3_cnt=np.nan,
cs_stdsc1_r6mcnt=np.nan,
cs_stdsc2_r6mcnt=np.nan,
cs_stdsc3_r6mcnt=np.nan,
cs_stdsc3_tapp=np.nan,
cs_stdsc2_tapp=np.nan,
cs_stdsc1_tapp=np.nan,
acs_fcs_cnt_inf_min=np.nan,
acs_fcs_cnt_inf_max=np.nan,
acs_fcs_cnt_inf_r6mmin=np.nan,
acs_fcs_cnt_inf_r6mmax=np.nan):
self.punished_cnt = punished_cnt # 被执行人信息记录数
self.court_putonrcrd_fsttapp = court_putonrcrd_fsttapp # 最早法院立案日期距离申请日期月份
self.court_putonrcrd_lsttapp = court_putonrcrd_lsttapp # 最近法院立案日期距离申请日期月份
self.cs_stdsc1_cnt = cs_stdsc1_cnt # 不披露的案件数
self.cs_stdsc2_cnt = cs_stdsc2_cnt # 已结案的案件数
self.cs_stdsc3_cnt = cs_stdsc3_cnt # 执行中的案件数
self.cs_stdsc1_r6mcnt = cs_stdsc1_r6mcnt # 最近6个月不披露的案件数
self.cs_stdsc2_r6mcnt = cs_stdsc2_r6mcnt # 最近6个月已结案的案件数
self.cs_stdsc3_r6mcnt = cs_stdsc3_r6mcnt # 最近6个月执行中的案件数
self.cs_stdsc3_tapp = cs_stdsc3_tapp # 最近一次执行中的案件距离申请时间点的月份
self.cs_stdsc2_tapp = cs_stdsc2_tapp # 最近一次已结案的案件距离申请时间点的月份
self.cs_stdsc1_tapp = cs_stdsc1_tapp # 最近一次不披露的案件距离申请时间点的月份
self.acs_fcs_cnt_inf_min = acs_fcs_cnt_inf_min # 被执行人关注次数最小值
self.acs_fcs_cnt_inf_max = acs_fcs_cnt_inf_max # 被执行人关注次数最大值
self.acs_fcs_cnt_inf_r6mmin = acs_fcs_cnt_inf_r6mmin # 最近6个月被执行人关注次数最小值
self.acs_fcs_cnt_inf_r6mmax = acs_fcs_cnt_inf_r6mmax # 最近6个月被执行人关注次数最大值 def __repr__(self):
return repr((self.punished_cnt,
self.court_putonrcrd_fsttapp,
self.court_putonrcrd_lsttapp,
self.cs_stdsc1_cnt,
self.cs_stdsc2_cnt,
self.cs_stdsc3_cnt,
self.cs_stdsc1_r6mcnt,
self.cs_stdsc2_r6mcnt,
self.cs_stdsc3_r6mcnt,
self.cs_stdsc3_tapp,
self.cs_stdsc2_tapp,
self.cs_stdsc1_tapp,
self.acs_fcs_cnt_inf_min,
self.acs_fcs_cnt_inf_max,
self.acs_fcs_cnt_inf_r6mmin,
self.acs_fcs_cnt_inf_r6mmax)) class RefereeDoc:
"""民商事裁判文书 model""" def __init__(self, hfw_cnt=np.nan, # 民商事裁判文书记录数
jdgmt_exec_cnt=np.nan, # 执行案件数
jdgmt_exec_cntr6m=np.nan, # 最近6个月执行案件数
admnpnshmainilgfctdsc_cnt=np.nan, # 行政处罚主要违法事实描述数
admnpnshmainilgfctdsc_cntr6m=np.nan, # 最近6个月行政处罚主要违法事实描述数
admnpnshmainilg_cnt=np.nan, # 行政处罚为合同纠纷数
admnpnshmainilg_cntr6m=np.nan, # 最近6个月行政处罚为合同纠纷数
admnpnshmainilg_rt=np.nan, # 行政处罚为合同纠纷数占比
case_obj_amt_r6m_cnt=np.nan, # 案件标的金额次数
case_obj_amt_max=np.nan, # 案件标的金额最大值
case_obj_amt_min=np.nan, # 案件标的金额最小值
case_obj_amt_avg=np.nan, # 案件表的金额平均值
case_obj_amt_p50=np.nan, # 案件标的金额中位数
hfw_ltgtn_obj_dsc_cnt=np.nan, # 诉讼标的描述类型数
hfw_ltgtn_obj_dsc_cntr6m=np.nan, # 最近6个月诉讼标的描述类型数
hfw_ltgtn_obj_dsc_tapp=np.nan, # 最近一次诉讼的描述为被告距离贷款申请月份数
hfw_ltgtn_obj_dsc_rt=np.nan, # 被告案件数占比
hfw_endcs_dt_fsttapp=np.nan, # 最早结案日期距离申请日期月份
hfw_endcs_dt_lsttapp=np.nan,
idmt_exec_fileno=np.nan,
admnpnshmainilgfctdsc=np.nan,
case_obj_amt=np.nan,
hfw_ltgtn_obj_dsc=np.nan,
endcs_dt=np.nan): # 最近结案日期距离申请日期月份
self.hfw_cnt = hfw_cnt
self.jdgmt_exec_cnt = jdgmt_exec_cnt
self.jdgmt_exec_cntr6m = jdgmt_exec_cntr6m
self.admnpnshmainilgfctdsc_cnt = admnpnshmainilgfctdsc_cnt
self.admnpnshmainilgfctdsc_cntr6m = admnpnshmainilgfctdsc_cntr6m
self.admnpnshmainilg_cnt = admnpnshmainilg_cnt
self.admnpnshmainilg_cntr6m = admnpnshmainilg_cntr6m
self.admnpnshmainilg_rt = admnpnshmainilg_rt
self.case_obj_amt_r6m_cnt = case_obj_amt_r6m_cnt
self.case_obj_amt_max = case_obj_amt_max
self.case_obj_amt_min = case_obj_amt_min
self.case_obj_amt_avg = case_obj_amt_avg
self.case_obj_amt_p50 = case_obj_amt_p50
self.hfw_ltgtn_obj_dsc_cnt = hfw_ltgtn_obj_dsc_cnt
self.hfw_ltgtn_obj_dsc_cntr6m = hfw_ltgtn_obj_dsc_cntr6m
self.hfw_ltgtn_obj_dsc_tapp = hfw_ltgtn_obj_dsc_tapp
self.hfw_ltgtn_obj_dsc_rt = hfw_ltgtn_obj_dsc_rt
self.hfw_endcs_dt_fsttapp = hfw_endcs_dt_fsttapp
self.hfw_endcs_dt_lsttapp = hfw_endcs_dt_lsttapp self.idmt_exec_fileno = idmt_exec_fileno
self.admnpnshmainilgfctdsc = admnpnshmainilgfctdsc
self.case_obj_amt = case_obj_amt
self.hfw_ltgtn_obj_dsc = hfw_ltgtn_obj_dsc
self.endcs_dt = endcs_dt def __repr__(self):
return repr((self.hfw_cnt,
self.jdgmt_exec_cnt,
self.jdgmt_exec_cntr6m,
self.admnpnshmainilgfctdsc_cnt,
self.admnpnshmainilgfctdsc_cntr6m,
self.admnpnshmainilg_cnt,
self.admnpnshmainilg_cntr6m,
self.admnpnshmainilg_rt,
self.case_obj_amt_r6m_cnt,
self.case_obj_amt_max,
self.case_obj_amt_min,
self.case_obj_amt_avg,
self.case_obj_amt_p50,
self.hfw_ltgtn_obj_dsc_cnt,
self.hfw_ltgtn_obj_dsc_cntr6m,
self.hfw_ltgtn_obj_dsc_tapp,
self.hfw_ltgtn_obj_dsc_rt,
self.hfw_endcs_dt_fsttapp,
self.hfw_endcs_dt_lsttapp,
self.idmt_exec_fileno,
self.admnpnshmainilgfctdsc,
self.case_obj_amt,
self.hfw_ltgtn_obj_dsc,
self.endcs_dt)) class Shareholder:
"""企业股东及出资信息类""" def __init__(self,
bsnlcns=np.nan,
shrh_nm=np.nan,
ivs_amt=np.nan,
ivs_dt=np.nan,
fndd_pctg_dsc=np.nan):
self.bsnlcns = bsnlcns
self.shrh_nm = shrh_nm
self.ivs_amt = ivs_amt
self.ivs_dt = ivs_dt
self.fndd_pctg_dsc = fndd_pctg_dsc def __repr__(self):
return repr((self.bsnlcns,
self.shrh_nm,
self.ivs_amt,
self.ivs_dt,
self.fndd_pctg_dsc)) class Frposition:
"""法定代表人其他公司任职类""" def __init__(self,
lgl_rprs_nm=np.nan,
org_char_cd=np.nan,
rgst_cpamt=np.nan,
bsnlcns_no=np.nan,
oprt_stcd=np.nan,
lout_dt=np.nan,
rvk_dt=np.nan,
post_stcd=np.nan,
wthr_lgl_rprs=np.nan,
org_estb_dt=np.nan,
):
self.lgl_rprs_nm = lgl_rprs_nm
self.org_char_cd = org_char_cd
self.rgst_cpamt = rgst_cpamt
self.bsnlcns_no = bsnlcns_no
self.oprt_stcd = oprt_stcd
self.lout_dt = lout_dt
self.rvk_dt = rvk_dt
self.post_stcd = post_stcd
self.wthr_lgl_rprs = wthr_lgl_rprs
self.org_estb_dt = org_estb_dt def __repr__(self):
return repr((self.lgl_rprs_nm,
self.org_char_cd,
self.rgst_cpamt,
self.bsnlcns_no,
self.oprt_stcd,
self.lout_dt,
self.rvk_dt,
self.post_stcd,
self.wthr_lgl_rprs,
self.org_estb_dt)) class Frinv:
def __init__(self,
lgl_rprs_nm=np.nan,
org_char_cd=np.nan,
rgst_cpamt=np.nan,
bsnlcns_no=np.nan,
oprt_stcd=np.nan,
lout_dt=np.nan,
rvk_dt=np.nan,
ivs_amt=np.nan,
fndd_mod_dsc=np.nan,
fndd_pctg_dsc=np.nan,
org_estb_dt=np.nan):
self.lgl_rprs_nm = lgl_rprs_nm
self.org_char_cd = org_char_cd
self.rgst_cpamt = rgst_cpamt
self.bsnlcns_no = bsnlcns_no
self.oprt_stcd = oprt_stcd
self.lout_dt = lout_dt
self.rvk_dt = rvk_dt
self.ivs_amt = ivs_amt
self.fndd_mod_dsc = fndd_mod_dsc
self.fndd_pctg_dsc = fndd_pctg_dsc
self.org_estb_dt = org_estb_dt def __repr__(self):
return repr((self.lgl_rprs_nm,
self.org_char_cd,
self.rgst_cpamt,
self.bsnlcns_no,
self.oprt_stcd,
self.lout_dt,
self.rvk_dt,
self.ivs_amt,
self.fndd_mod_dsc,
self.fndd_pctg_dsc,
self.org_estb_dt
)) class fn_list(db.Model):
__tablename__ = 'fn_list'
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
column1 = db.Column(db.Text, nullable=True)
column2 = db.Column(db.Text, nullable=True)
column3 = db.Column(db.Text, nullable=True)
column4 = db.Column(db.Text, nullable=True)
column5 = db.Column(db.Text, nullable=True)
column6 = db.Column(db.Text, nullable=True)
column7 = db.Column(db.Text, nullable=True)
column8 = db.Column(db.Text, nullable=True)
column9 = db.Column(db.Text, nullable=True)
column10 = db.Column(db.Text, nullable=True) column11 = db.Column(db.Text, nullable=True)
column12 = db.Column(db.Text, nullable=True)
column13 = db.Column(db.Text, nullable=True)
column14 = db.Column(db.Text, nullable=True)
column15 = db.Column(db.Text, nullable=True)
column16 = db.Column(db.Text, nullable=True)
column17 = db.Column(db.Text, nullable=True)
column18 = db.Column(db.Text, nullable=True)
column19 = db.Column(db.Text, nullable=True)
column20 = db.Column(db.Text, nullable=True) column21 = db.Column(db.Text, nullable=True)
column22 = db.Column(db.Text, nullable=True)
column23 = db.Column(db.Text, nullable=True)
column24 = db.Column(db.Text, nullable=True)
column25 = db.Column(db.Text, nullable=True)
column26 = db.Column(db.Text, nullable=True)
column27 = db.Column(db.Text, nullable=True)
column28 = db.Column(db.Text, nullable=True)
column29 = db.Column(db.Text, nullable=True)
column30 = db.Column(db.Text, nullable=True) db.create_all() def insert_fn_list():
fn = fn_list(
column1="basic",
column2="b1",
column3="b3",
column4="b4",
column5="b5",
column6="b6",
column7="b7",
column8="b8",
column9="b9",
column10="b10",
column11="b11",
column12="b12",
column13="b13",
column14="b14",
column15="b15",
column16="b16",
column17="b17",
column18="b18",
column19="b19",
column20="b20",
column21="b21",
column22="b22",
column23="b23",
column24="b24",
column25="b25",
column26="b26",
column27="b27",
column28="b28",
column29="b29",
column30="b30",
)
db.session.add(fn) fn = fn_list(column1="alter",
column2="a1",
column3="a3",
column4="a4",
column5="a5",
column6="a6",
column7="a7",
column8="a8",
column9="a9",
column10="a10",
column11="aa11",
column12="a12",
column13="a13",
column14="a14",
column15="a15",
column16="a16",
column17="a17",
column18="a18",
column19="a19",
column20="a20",
column21="a21",
column22="a22",
column23="a23",
column24="a24",
column25="a25",
column26="a26",
column27="a27",
column28="a28",
column29="a29",
column30="a30",
)
db.session.add(fn) fn = fn_list(column1="alter",
column2="a31",
column3="a32",
column4="a33",
column5="a34",
column6="a35",
column7="a36",
column8="a37",
column9="a38",
column10="a39",
column11="aa40",
column12="a41",
column13="a42",
column14="a43",
column15="a44",
column16="a45",
column17="a46",
column18="a47",
column19="a48",
column20="a49",
column21="a50",
column22="a51",
column23="a52",
column24="a53",
column25="a54",
column26="a55",
column27="a56",
column28="a57",
column29="a58",
column30="a59",
)
db.session.add(fn) fn = fn_list(column1="person",
column2="p1",
column3="p3",
column4="p4",
column5="p5",
column6="p6",
column7="p7",
column8="p8",
column9="p9",
column10="p10",
column11="p11",
column12="p12",
column13="p13",
column14="p14",
column15="p15",
column16="p16",
column17="p17",
column18="p18",
column19="p19",
column20="p20",
column21="p21",
column22="p22",
column23="p23",
column24="p24",
column25="p25",
column26="p26",
column27="p27",
column28="p28",
column29="p29",
column30="p30",
)
db.session.add(fn) fn = fn_list(column1="person",
column2="p31",
column3="p32",
column4="p33p",
column5="p34",
column6="p35",
column7="p36",
column8="p37",
column9="p38",
column10="p39",
column11="p40",
column12="p41",
column13="p42",
column14="p43",
column15="p44",
column16="p45",
column17="p46",
column18="p47",
column19="p48",
column20="p49",
column21="p50",
column22="p51",
column23="p52",
column24="p53",
column25="p54",
column26="p55",
column27="p56",
column28="p57",
column29="p58",
column30="p59",
)
db.session.add(fn) fn = fn_list(column1="shareholder",
column2="s1",
column3="s3",
column4="s4",
column5="s5",
column6="s6",
column7="s7",
column8="s8",
column9="s9",
column10="s10",
column11="s11",
column12="b12",
column13="b13",
column14="b14",
column15="b15",
column16="b16",
column17="b17",
column18="b18",
column19="b19",
column20="b20",
column21="b21",
column22="b22",
column23="b23",
column24="b24",
column25="b25",
column26="b26",
column27="b27",
column28="b28",
column29="b29",
column30="b30",
)
db.session.add(fn) fn = fn_list(column1="shareholder",
column2="s31",
column3="s33",
column4="s34",
column5="s35",
column6="s36",
column7="s37",
column8="s38",
column9="s39",
column10="s40",
column11="s41",
column12="b42",
column13="b43",
column14="b44",
column15="b45",
column16="b46",
column17="b47",
column18="b48",
column19="b49",
column20="b50",
column21="b51",
column22="b52",
column23="b53",
column24="b54",
column25="b55",
column26="b56",
column27="b57",
column28="b58",
column29="b59",
column30="b60",
)
db.session.add(fn) fn = fn_list(column1="referee", column2="referee1")
db.session.add(fn) fn = fn_list(column1="referee", column2="referee2")
db.session.add(fn) fn = fn_list(column1="frinv", column2="frinv1")
db.session.add(fn) fn = fn_list(column1="frinv", column2="frinv2")
db.session.add(fn) fn = fn_list(column1="frposition", column2="frposition1")
db.session.add(fn) fn = fn_list(column1="frposition", column2="frposition2")
db.session.add(fn)
db.session.commit()
pass class fetch_list:
def __init__(self,
basic_list=[],
alter_list=[],
person_list=[],
shareholder_list=[],
referee_list=[],
frinv_list=[],
frposition_list=[]):
self.basic_list = basic_list
self.alter_list = alter_list
self.person_list = person_list
self.shareholder_list = shareholder_list
self.referee_list = referee_list
self.frinv_list = frinv_list
self.frposition_list = frposition_list def __repr__(self):
return repr((self.basic_list,
self.alter_list,
self.person_list,
self.shareholder_list,
self.referee_list,
self.frinv_list,
self.frposition_list))
# basic_list = []
# alter_list = []
# person_list = []
# shareholder_list = []
# referee_list = []
# frinv_list = []
# frposition_list = [] class basic_mapper:
def obj_mapper2_list(self, data, list):
b = Basic()
b.prmsn_oprt_prj_dsc = data.column2
b.lout_dt = data.column3
b.rvk_dt = data.column4
b.idy_tpcd = data.column5
b.bsnlcns_no = data.column6
b.old_bsnlcns_no = data.column7
b.lgl_rprs_nm = data.column8
b.entp_info_idr = data.column9
b.orgacinccptl_amt = data.column10
b.rgst_cpamt = data.column11
b.rgst_cptl_ccycd = data.column12
b.oprt_stcd = data.column13
b.org_char_cd = data.column14
b.org_estb_dt = data.column15
b.oprt_trm_stdt = data.column16
b.dtl_adr = data.column17
b.issuctf_aht_nm = data.column18
b.entnm = data.column19
b.unn_soc_cr_cd = data.column20
list.append(b)
return list
pass class alter_mapper:
def obj_mapper2_list(self, data, list):
a = Alter()
a.mdf_bfr_cntnt = data.column2
a.mdf_dt = data.column3
a.mdf_itm = data.column4
a.afmd_cntnt = data.column5
list.append(a)
pass class person_mapper:
def obj_mapper2_list(self, data, list):
p = Person()
p.ip_nm = data.column2
p.post_tp_cd = data.column3
p.gnd_cd = data.column4
list.append(p)
pass class shareholder_mapper:
def obj_mapper2_list(self, data, list):
s = Shareholder()
s.bsnlcns = data.column2
s.shrh_nm = data.column3
s.ivs_amt = data.column4
s.ivs_dt = data.column5
s.fndd_pctg_dsc = data.column6
list.append(s)
pass class referee_mapper:
def obj_mapper2_list(self, data, list):
r = RefereeDoc()
r.idmt_exec_fileno = data.column2
r.admnpnshmainilgfctdsc = data.column3
r.case_obj_amt = data.column4
r.hfw_ltgtn_obj_dsc = data.column5
r.endcs_dt = data.column6
list.append(r)
pass class frinv_mapper:
def obj_mapper2_list(self, data, list):
f = Frinv()
f.lgl_rprs_nm = data.column2
f.org_char_cd = data.column3
f.rgst_cpamt = data.column4
f.bsnlcns_no = data.column5
f.oprt_stcd = data.column6
f.lout_dt = data.column7
f.rvk_dt = data.column8
f.ivs_amt = data.column9
f.fndd_mod_dsc = data.column10
f.fndd_pctg_dsc = data.column11
f.org_estb_dt = data.column12
list.append(f)
pass class frposition_mapper:
def obj_mapper2_list(self, data, list):
f = Frposition()
f.lgl_rprs_nm = data.column2
f.org_char_cd = data.column3
f.rgst_cpamt = data.column4
f.bsnlcns_no = data.column5
f.oprt_stcd = data.column6
f.lout_dt = data.column7
f.rvk_dt = data.column8
f.post_stcd = data.column9
f.wthr_lgl_rprs = data.column10
f.org_estb_dt = data.column11
list.append(f)
pass def select_fn_list():
bm = basic_mapper()
am = alter_mapper()
pm = person_mapper()
sm = shareholder_mapper()
rm = referee_mapper()
frinvm = frinv_mapper()
frpositionm = frposition_mapper()
fli = fetch_list()
type_list = {"basic": fli.basic_list, "alter": fli.alter_list, "person": fli.person_list,
"shareholder": fli.shareholder_list, "referee": fli.referee_list, "frinv": fli.frinv_list,
"frposition": fli.frposition_list}
pro_list = {"basic": bm, "alter": am, "person": pm,
"shareholder": sm, "referee": rm, "frinv": frinvm,
"frposition": frpositionm}
list = fn_list.query
for obj in list:
key = obj.column1
pro_list[key].obj_mapper2_list(obj, type_list[key])
ii =
json_str = json.dumps(fli, default=lambda o: o.__dict__, sort_keys=True, indent=)
print(json_str) # insert_fn_list()
select_fn_list() @app.route('/')
def index():
return 'index db'

python SQLAlchemy对象映射和json.dumps无法序列化问题解决的更多相关文章

  1. Python下调用json.dumps中文显示问题解决办法

    json.dumps在默认情况下,对于非ascii字符生成的是相对应的字符编码,而非原始字符,例如: import json js = json.loads('{"haha": & ...

  2. Python json.dumps 自定义序列化操作

    def login_ajax(request): if request.method == "GET": return render(request, 'login_ajax.ht ...

  3. python class对象转换成json/字典

    # -*- encoding: UTF-8 -*- class Student: name = '' age = 0 def __init__(self, name, age): self.name ...

  4. python的eval和json.loads(),json.dumps()

    eval() 将字符串当成一个表达式去执行,可以想象成一个去字符串然后执行的操作. In [1]: s = '3*8' In [2]: eval(s) Out[2]: 24 eval()和json.l ...

  5. python将字符串转换成对应的python数据类型--eval和json.loads(),json.dumps()

    eval()和json.loads() 都可以将字符串转换成对应的python数据类型,举个字典的例子,同样适合其他数据类型元组.列表.集合. In [3]: ss = '{"a" ...

  6. Python json.dumps 特殊数据类型的自定义序列化操作

    场景描述: Python标准库中的json模块,集成了将数据序列化处理的功能:在使用json.dumps()方法序列化数据时候,如果目标数据中存在datetime数据类型,执行操作时, 会抛出异常:T ...

  7. Python之路-python(装饰器、生成器、迭代器、Json & pickle 数据序列化、软件目录结构规范)

    装饰器: 首先来认识一下python函数, 定义:本质是函数(功能是装饰其它函数),为其它函数添加附件功能        原则:        1.不能修改被装饰的函数的源代码.        2.不 ...

  8. Python学习笔记十:json序列化,软件结构目录规范,ATM作业讲解,import本质论

    json序列化 将系统的某个状态保存为字符串(挂起),序列化. import json json.dumps():序列化 json.loads():反序列化 简单类型数据处理 import pickl ...

  9. Python学习---重点模块之json

    注意:JSON不能转换类,不能转换函数 重点方法示例 json.dumps():实现文件写入,字符串转换[写入文件当然是JSON字符串楼] 实际上,json.dumps()只是帮我们做了一个字符串的转 ...

随机推荐

  1. 2.7、CDH 搭建Hadoop在安装(使用向导设置群集)

    步骤7:使用向导设置群集 完成“ 群集安装”向导后,“ 群集设置”向导将自动启动.以下部分将指导您完成向导的每个页面: 选择服务 分配角色 设置数据库 查看更改 首次运行命令 恭喜! 选择服务 “ 选 ...

  2. python-ceilometerclient命令行(1)

    1.导入模块,可以动态获取模块中方法并调用,其功能与from...import...一致 2. callback = getattr(actions_module, attr) 从模块中获取方法. 调 ...

  3. maven项目下出现java.lang.ClassNotFoundException: ContextLoader异常

    原因:出现此异常是因为tomcat的webapp目录下没有lib文件. 解决方案: 1.右键点击项目--选择Properties选择Deployment Assembly,在右边点击Add按钮,在弹出 ...

  4. SpringCloud报错: "Field discoveryClient in com.controller.DcController required a bean of type 'com.netflix.discovery.DiscoveryClient' that could not be found."

    SpringCloud报错: "Field discoveryClient in com.controller.DcController required a bean of type 'c ...

  5. 【转】iOS 自动化性能采集

      前言 对于iOS总体生态是比较封闭的,相比Android没有像adb这种可以查看内存.cpu的命令.在日常做性能测试,需要借助xcode中instruments查看内存.cpu等数据. 但是借助i ...

  6. 微信小程序开发——全局配置详细介绍

    本文针对官方文档未说明清楚的进行详细探索研究,官方文档详见:全局配置 . pages: 删除页面,需要先删除app.json中pages对应页面的路径,再去删除页面相关的所有文件,不然会出现页面文件混 ...

  7. 项目总结10:通过反射解决springboot环境下从redis取缓存进行转换时出现ClassCastException异常问题

    通过反射解决springboot环境下从redis取缓存进行转换时出现ClassCastException异常问题 关键字 springboot热部署  ClassCastException异常 反射 ...

  8. 896. Monotonic Array单调数组

    [抄题]: An array is monotonic if it is either monotone increasing or monotone decreasing. An array A i ...

  9. swift - 本地通知2 - 啰嗦版

    1. import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var windo ...

  10. day 05 字典,字典嵌套

    字典: 1.列表如果存储大量数据,查询速度相对慢一些 2.列表存储的数据,一般没有什么关联性 针对以上原因,python提供了一个基础数据类型,dict 字典 数据类型的分类 : 容器型数据类型:li ...