Commit 0bae380c authored by 赵杰's avatar 赵杰

浙江白鹭

parent 4c1ceda0
...@@ -411,7 +411,7 @@ def get_fund_name(fund, fund_type=1): ...@@ -411,7 +411,7 @@ def get_fund_name(fund, fund_type=1):
data = cur.fetchall() data = cur.fetchall()
df = pd.DataFrame(list(data), columns=['fund_short_name']) df = pd.DataFrame(list(data), columns=['fund_short_name'])
return df return df
elif fund_type == 1 or fund_type == 2: elif fund_type == 1:
with TAMP_SQL(tamp_fund_engine) as tamp_fund: with TAMP_SQL(tamp_fund_engine) as tamp_fund:
tamp_fund_session = tamp_fund.session tamp_fund_session = tamp_fund.session
sql = "SELECT fund_short_name FROM fund_info WHERE id='{}'".format(fund) sql = "SELECT fund_short_name FROM fund_info WHERE id='{}'".format(fund)
...@@ -419,15 +419,15 @@ def get_fund_name(fund, fund_type=1): ...@@ -419,15 +419,15 @@ def get_fund_name(fund, fund_type=1):
cur = tamp_fund_session.execute(sql) cur = tamp_fund_session.execute(sql)
data = cur.fetchall() data = cur.fetchall()
df = pd.DataFrame(list(data), columns=['fund_short_name']) df = pd.DataFrame(list(data), columns=['fund_short_name'])
if len(df) == 0: return df
with TAMP_SQL(tamp_product_engine) as tamp_product: elif fund_type == 2:
tamp_product_session = tamp_product.session with TAMP_SQL(tamp_product_engine) as tamp_product:
sql = "SELECT fund_short_name FROM fund_info WHERE id='{}'".format(fund) tamp_product_session = tamp_product.session
# df = pd.read_sql(sql, con) sql = "SELECT fund_short_name FROM fund_info WHERE id='{}'".format(fund)
cur = tamp_product_session.execute(sql) # df = pd.read_sql(sql, con)
data = cur.fetchall() cur = tamp_product_session.execute(sql)
df = pd.DataFrame(list(data), columns=['fund_short_name']) data = cur.fetchall()
return df df = pd.DataFrame(list(data), columns=['fund_short_name'])
return df return df
else: else:
with TAMP_SQL(tamp_fund_engine) as tamp_fund: with TAMP_SQL(tamp_fund_engine) as tamp_fund:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment